Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ErrorCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| value | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Eco\Enums; |
| 6 | |
| 7 | use Eco\Contracts\ErrorCodeContract; |
| 8 | |
| 9 | /** |
| 10 | * Built-in error codes provided by the library. |
| 11 | * |
| 12 | * For domain-specific codes, implement {@see ErrorCodeContract} |
| 13 | * on your own enum and pass it directly to {@see Error}. |
| 14 | */ |
| 15 | enum ErrorCode: string implements ErrorCodeContract |
| 16 | { |
| 17 | case GENERIC = 'GENERIC_ERROR'; |
| 18 | case VALIDATION = 'VALIDATION_ERROR'; |
| 19 | |
| 20 | public function value(): string |
| 21 | { |
| 22 | return $this->value; |
| 23 | } |
| 24 | } |