final class Collection
Collection of Error objects.
| Namespace | BeastBytes\CodPhp\Error |
|---|---|
| Inheritance | BeastBytes\CodPhp\Error\Collection |
Methods
addError()
Add an error to the collection.
| public static function addError(string $message, BeastBytes\CodPhp\Element\Element $element, array $context = []): BeastBytes\CodPhp\Error\Error | ||
| $message | string | Error message. |
| $element | BeastBytes\CodPhp\Element\Element | Element causing the error. |
| $context | array | Additional information about the error. |
| return | BeastBytes\CodPhp\Error\Error | |
Declared in BeastBytes\CodPhp\Error\Collection
addNotice()
Add a notice to the collection.
| public static function addNotice(string $message, BeastBytes\CodPhp\Element\Element $element, array $context = []): BeastBytes\CodPhp\Error\Error | ||
| $message | string | Error message. |
| $element | BeastBytes\CodPhp\Element\Element | Element causing the error. |
| $context | array | Additional information about the error. |
| return | BeastBytes\CodPhp\Error\Error | |
Declared in BeastBytes\CodPhp\Error\Collection
addWarning()
Add a warning to the collection.
| public static function addWarning(string $message, BeastBytes\CodPhp\Element\Element $element, array $context = []): BeastBytes\CodPhp\Error\Error | ||
| $message | string | Error message. |
| $element | BeastBytes\CodPhp\Element\Element | Element causing the error. |
| $context | array | Additional information about the error. |
| return | BeastBytes\CodPhp\Error\Error | |
Declared in BeastBytes\CodPhp\Error\Collection
asJson()
Returns a collection of errors as a JSON object.
| public static function asJson(): string | ||
| return | string | |
| throws | JsonException | |
Declared in BeastBytes\CodPhp\Error\Collection
Related
- https://www.json.org - JSON specification.
getErrors()
Returns an array of Error objects.
The array is either an array of Error objects at the specified level, or an array of arrays of Error objects index by error level.
| public static function getErrors(BeastBytes\CodPhp\Error\ErrorLevel|null $level = null): array | ||
| $level | BeastBytes\CodPhp\Error\ErrorLevel|null | Error level to return, or all error levels if `null`. |
| return | array | Errors in the collection, either at the specified error level, or indexed by error level |
Declared in BeastBytes\CodPhp\Error\Collection
hasErrors()
Returns a boolean indicating whether the collection contains errors.
Reports on a particular error level if $level is an ErrorLevel, or all error levels if $level === null.
| public static function hasErrors(BeastBytes\CodPhp\Error\ErrorLevel|null $level = null): bool | ||
| $level | BeastBytes\CodPhp\Error\ErrorLevel|null | The error level to report, or all error levels if `null`. |
| return | bool | Whether the collection has errors at the specified error level. |
Declared in BeastBytes\CodPhp\Error\Collection
Generated by CodPhp