Completed
Push — master ( 8343ec...f446cd )
by Valentyn
12:07
created

UpdateMovieRequest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 7
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A rules() 0 19 1
1
<?php
2
3
namespace App\Movies\Request;
4
5
use App\Request\BaseRequest;
6
use Symfony\Component\Validator\Constraints as Assert;
7
8
class UpdateMovieRequest extends BaseRequest
9
{
10
    public function rules()
11
    {
12
        return new Assert\Collection([
13
            'movie' => new Assert\Collection([
14
                // Movie
15
                'originalTitle' => [new Assert\NotBlank(), new Assert\Length(['min' => 2, 'max' => 100])],
16
                'imdbId' => new Assert\Length(['min' => 5, 'max' => 20]),
17
                'runtime' => new Assert\Type(['type' => 'integer']),
18
                'budget' => new Assert\Type(['type' => 'integer']),
19
                'releaseDate' => new Assert\Date(),
20
                // MovieTranslations[]
21
                'translations' => $this->eachItemValidation([
22
                    'locale' => [new Assert\NotBlank(), new Assert\Locale()],
23
                    'title' => [new Assert\NotBlank(), new Assert\Length(['min' => 3, 'max' => 50])],
24
                    'overview' => [new Assert\NotBlank()],
25
                ]),
26
            ]),
27
        ]);
28
    }
29
}
30