| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 30 | public function validate($value, Constraint $constraint) |
||
| 31 | { |
||
| 32 | if (null === $value) { |
||
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | Assert::isInstanceOf( |
||
| 37 | $value, |
||
| 38 | PromotionInterface::class |
||
| 39 | ); |
||
| 40 | |||
| 41 | if (null === $value->getStartsAt() || null === $value->getEndsAt()) { |
||
| 42 | return; |
||
| 43 | } |
||
| 44 | |||
| 45 | if ($value->getStartsAt()->getTimestamp() > $value->getEndsAt()->getTimestamp()) { |
||
| 46 | $this->context->buildViolation($constraint->message) |
||
| 47 | ->atPath('endsAt') |
||
| 48 | ->addViolation(); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 |