Passed
Pull Request — master (#1)
by Peter
03:06
created

ContentList   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createValidator() 0 31 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Website\Validation\Factory;
6
7
use Opulence\Validation\Factories\ValidatorFactory;
8
use Opulence\Validation\IValidator;
9
10
class ContentList extends ValidatorFactory
11
{
12
    /**
13
     * @return IValidator
14
     */
15
    public function createValidator(): IValidator
16
    {
17
        $validator = parent::createValidator();
18
19
        $validator
20
            ->field('id')
21
            ->uuid();
22
23
        $validator
24
            ->field('identifier');
25
26
        $validator
27
            ->field('name')
28
            ->required();
29
30
        $validator
31
            ->field('protected')
32
            ->min(1)
33
            ->max(1);
34
35
        $validator
36
            ->field('with_image')
37
            ->min(1)
38
            ->max(1);
39
40
        $validator
41
            ->field('with_links')
42
            ->min(1)
43
            ->max(1);
44
45
        return $validator;
46
    }
47
}
48