Completed
Push — master ( b4d909...e3c084 )
by Valentyn
03:37
created

UpdateActorRequest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 7
dl 0
loc 22
ccs 12
cts 12
cp 1
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\Actors\Request;
4
5
use App\Actors\Entity\Actor;
6
use App\Request\BaseRequest;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
class UpdateActorRequest extends BaseRequest
10
{
11 2
    public function rules()
12
    {
13 2
        return new Assert\Collection([
14 2
            'actor' => new Assert\Collection([
15
                // Movie
16 2
                'originalName' => [new Assert\NotBlank(), new Assert\Length(['min' => 2, 'max' => 100])],
17 2
                'imdbId' => new Assert\Length(['min' => 5, 'max' => 20]),
18 2
                'birthday' => new Assert\Date(),
19 2
                'gender' => new Assert\Choice([Actor::GENDER_MALE, Actor::GENDER_FEMALE]),
20
                // MovieTranslations[]
21 2
                'translations' => $this->eachItemValidation([
22 2
                    'locale' => [new Assert\NotBlank(), new Assert\Locale()],
23 2
                    'name' => [new Assert\NotBlank(), new Assert\Length(['min' => 2, 'max' => 100])],
24 2
                    'placeOfBirth' => [new Assert\NotBlank(), new Assert\Length(['max' => 100])],
25 2
                    'biography' => [new Assert\NotBlank()],
26
                ]),
27
            ]),
28
        ]);
29
    }
30
}
31