Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| PropertyDefinitionName | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 | |
0.00% |
0 / 1 |
| validate | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 | |||
| 1 | <?php |
| 2 | namespace Apie\Maker\ValueObjects; |
| 3 | |
| 4 | use Apie\Core\Identifiers\CamelCaseSlug; |
| 5 | use Apie\Serializer\Exceptions\ValidationException; |
| 6 | use LogicException; |
| 7 | |
| 8 | final class PropertyDefinitionName extends CamelCaseSlug |
| 9 | { |
| 10 | public static function validate(string $input): void |
| 11 | { |
| 12 | parent::validate($input); |
| 13 | if (strtolower($input) === 'id') { |
| 14 | throw ValidationException::createFromArray(['' => new LogicException('The name "id" is already reserved')]); |
| 15 | } |
| 16 | } |
| 17 | } |