| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 30 | 18 | public function validate(Argument $argument, Context $context): void |
|
| 31 | { |
||
| 32 | 18 | $execution = $context->getExecution(); |
|
| 33 | 18 | $value = $argument->getValueByArgumentName(); |
|
| 34 | |||
| 35 | 18 | if (is_string($value) && is_int(strtotime($value))) { |
|
| 36 | 6 | return; |
|
| 37 | } |
||
| 38 | |||
| 39 | 12 | $execution->buildViolation(self::INVALID_DATE_MESSAGE) |
|
| 40 | 12 | ->atPath(PropertyPath::append($context->getRootPath(), $argument->getName())) |
|
| 41 | 12 | ->setInvalidValue($value) |
|
| 42 | 12 | ->setCode(self::INVALID_DATE_CODE) |
|
| 43 | 12 | ->addViolation() |
|
| 44 | ; |
||
| 47 |