NoMakeup   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 11
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 9 4
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