Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ErrorCode | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getMessage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Shared\Domain\Exception; |
| 4 | |
| 5 | /** |
| 6 | * @author Wilhelm Zwertvaegher |
| 7 | */ |
| 8 | enum ErrorCode: string implements BaseErrorCode |
| 9 | { |
| 10 | case UNKNOWN_ERROR = 'Unknown error'; |
| 11 | case INVALID_EMAIL = 'Invalid email'; |
| 12 | case INVALID_URL = 'Invalid url'; |
| 13 | case INVALID_UUID = 'Invalid uuid'; |
| 14 | case FIELD_CANNOT_BE_NULL = 'The field cannot be null'; |
| 15 | case FIELD_CANNOT_BE_EMPTY = 'The field cannot be empty'; |
| 16 | case FIELD_VALUE_TOO_SMALL = 'The field value is too small'; |
| 17 | case FIELD_VALUE_TOO_BIG = 'The field value is too big'; |
| 18 | case FIELD_VALUE_TOO_SHORT = 'The field value is too short'; |
| 19 | case FIELD_VALUE_TOO_LONG = 'The field value is too long'; |
| 20 | |
| 21 | case ENTITY_NOT_FOUND = 'Entity not found'; |
| 22 | |
| 23 | public function getMessage(): string |
| 24 | { |
| 25 | return $this->value; |
| 26 | } |
| 27 | |
| 28 | public function getCode(): string |
| 29 | { |
| 30 | return $this->name; |
| 31 | } |
| 32 | } |