Passed
Push — master ( bf42cc...349842 )
by Peter
05:57
created

Form::createValidator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 22
rs 9.7666
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Contact\Validation\Factory;
6
7
use Opulence\Validation\Factories\ValidatorFactory;
8
use Opulence\Validation\IValidator;
9
10
class Form 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('name')
25
            ->required();
26
27
        $validator
28
            ->field('to_name')
29
            ->required();
30
31
        $validator
32
            ->field('to_email')
33
            ->email()
34
            ->required();
35
36
        return $validator;
37
    }
38
}
39