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

RequiredConstraintValidator::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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