| Total Complexity | 6 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 60% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 1 | class Error implements IteratorAggregate |
|
| 17 | { |
||
| 18 | |||
| 19 | 1 | public function __construct( |
|
| 20 | private readonly string $field, |
||
| 21 | private readonly string $message, |
||
| 22 | private readonly int $code, |
||
| 23 | ) |
||
| 24 | { |
||
| 25 | 1 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Get error code |
||
| 29 | */ |
||
| 30 | public function getCode(): int |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Get error field name |
||
| 37 | */ |
||
| 38 | public function getField(): string |
||
| 39 | { |
||
| 40 | 1 | return $this->field; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Get validation error message |
||
| 45 | */ |
||
| 46 | public function getMessage(): string |
||
| 47 | { |
||
| 48 | 1 | return $this->message; |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Iterate through error data to convert it |
||
| 53 | */ |
||
| 54 | public function getIterator(): Traversable |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Converts error caret to an array |
||
| 61 | * @return array<string, string|int> |
||
| 62 | */ |
||
| 63 | public function toArray(): array |
||
| 69 | ]; |
||
| 70 | } |
||
| 72 |