FaceIsNotCovered   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 9
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 7 3
1
<?php
2
3
namespace XSolve\FaceValidatorBundle\Validator\Specification;
4
5
use XSolve\FaceValidatorBundle\Result\Accessory;
6
use XSolve\FaceValidatorBundle\Result\FaceDetectionResult;
7
use XSolve\FaceValidatorBundle\Validator\Constraints\Face;
8
9
class FaceIsNotCovered implements FaceValidationSpecification
10
{
11
    public function evaluate(FaceDetectionResult $result, Face $constraint): Evaluation
12
    {
13
        if ($constraint->allowCoveringFace || !in_array(Accessory::MASK(), $result->getAccessories())) {
14
            return new Evaluation(true);
15
        }
16
17
        return new Evaluation(false, $constraint->faceCoveredMessage);
18
    }
19
}
20