Lines
100.00%
1 / 1
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| NoOverlappingTravel | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| getTargets | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace App\Validator; | |
| 6 | ||
| 7 | use Symfony\Component\Validator\Constraint; | |
| 8 | ||
| 9 | /** | |
| 10 | * On a TimelineEvent: a travel (an event with an end date) must not share a day with another | |
| 11 | * travel of its owner, so that the timeline has at most one travel at a time. | |
| 12 | */ | |
| 13 | #[\Attribute(\Attribute::TARGET_CLASS)] | |
| 14 | final class NoOverlappingTravel extends Constraint | |
| 15 | { | |
| 16 | public string $message = 'Travels cannot overlap: {{ travel }}.'; | |
| 17 | ||
| 18 | public function getTargets(): string | |
| 19 | { | |
| 20 | return self::CLASS_CONSTRAINT; | |
| 21 | } | |
| 22 | } |