Доработка коллекций и не только
- коллекция `Items` с покрытием - вынос коллекций из `AtolOnline\Entities` в `AtolOnline\Collections` - фикс ] в `AtolException` - финализирован `CorrectionInfo` - фиксы по тестам коллекций - прочие мелочи по phpdoc
This commit is contained in:
@@ -33,7 +33,7 @@ class AtolException extends Exception
|
||||
{
|
||||
$tags = implode(', ', $ffd_tags ?: $this->ffd_tags);
|
||||
parent::__construct(
|
||||
($message ?: $this->message) . ($tags ? ' [Теги ФФД: ' . $tags : '') . ']'
|
||||
($message ?: $this->message) . ($tags ? ' [Теги ФФД: ' . $tags . ']' : '')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
37
src/Exceptions/InvalidEntityInCollectionException.php
Normal file
37
src/Exceptions/InvalidEntityInCollectionException.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Антон Аксенов (Anthony Axenov)
|
||||
*
|
||||
* This code is licensed under MIT.
|
||||
* Этот код распространяется по лицензии MIT.
|
||||
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace AtolOnline\Exceptions;
|
||||
|
||||
/**
|
||||
* Исключение, возникающее при наличии некорректных объектов в коллекции
|
||||
*/
|
||||
class InvalidEntityInCollectionException extends AtolException
|
||||
{
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @param string $collection_class
|
||||
* @param string $expected_class
|
||||
* @param mixed $actual
|
||||
*/
|
||||
public function __construct(string $collection_class, string $expected_class, mixed $actual)
|
||||
{
|
||||
if (is_object($actual)) {
|
||||
$actual = $actual::class;
|
||||
} elseif (is_scalar($actual)) {
|
||||
$actual = '(' . gettype($actual) . ')' . var_export($actual, true);
|
||||
}
|
||||
parent::__construct(
|
||||
"Коллекция $collection_class должна содержать объекты $expected_class, найден $actual"
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user