NoMakeup::evaluate()   A
last analyzed

Complexity

Conditions 4
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.2
cc 4
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace XSolve\FaceValidatorBundle\Validator\Specification;
4
5
use XSolve\FaceValidatorBundle\Result\FaceDetectionResult;
6
use XSolve\FaceValidatorBundle\Validator\Constraints\Face;
7
8
class NoMakeup implements FaceValidationSpecification
9
{
10
    public function evaluate(FaceDetectionResult $result, Face $constraint): Evaluation
11
    {
12
        $makeup = $result->getMakeup();
13
14
        if ($constraint->allowMakeup || ($makeup->isOnFace() && !$makeup->isOnLips())) {
15
            return new Evaluation(true);
16
        }
17
18
        return new Evaluation(false, $constraint->makeupMessage);
19
    }
20
}
21