FaceIsNotCovered::evaluate()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 3
nc 2
nop 2
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