| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | 1 | public function rules() |
|
| 13 | { |
||
| 14 | $cardTypes = [ |
||
| 15 | 1 | MovieCard::TYPE_WATCH, |
|
| 16 | 1 | MovieCard::TYPE_WATCH_FREE, |
|
| 17 | 1 | MovieCard::TYPE_DOWNLOAD, |
|
| 18 | 1 | MovieCard::TYPE_REVIEW, |
|
| 19 | 1 | MovieCard::TYPE_TRAILER |
|
| 20 | ]; |
||
| 21 | |||
| 22 | 1 | return new Assert\Collection([ |
|
| 23 | 1 | 'card' => new Assert\Collection([ |
|
| 24 | 1 | 'title' => [new Assert\NotBlank(), new Assert\Length(['min' => 2, 'max' => 255])], |
|
| 25 | 1 | 'description' => new Assert\Length(['max' => 255]), |
|
| 26 | 1 | 'url' => [new Assert\NotBlank(), new Assert\Length(['max' => 255]), new Assert\Url()], |
|
| 27 | 1 | 'type' => [new Assert\NotBlank(), new Assert\Choice($cardTypes)], |
|
| 28 | ]), |
||
| 29 | ]); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |