Test Failed
Push — develop ( cc6a8c...2132bf )
by Freddie
15:51
created

RequiredConstraintValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 7 1
1
<?php
2
3
namespace FlexPHP\Generator\Domain\Validators\Constraints;
4
5
use Symfony\Component\Validator\Constraints\Choice;
6
use Symfony\Component\Validator\Constraints\NotNull;
7
use Symfony\Component\Validator\Validation;
8
9
/**
10
 * @Annotation
11
 */
12
class RequiredConstraintValidator
13
{
14
    public function validate($bool)
15
    {
16
        $validator = Validation::createValidator();
17
18
        return $validator->validate($bool, [
19
            new NotNull(),
20
            new Choice([true, false, 'true', 'false']),
21
        ]);
22
    }
23
}
24