NoiseLevel::isLowerOrEqual()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
namespace XSolve\FaceValidatorBundle\Result;
4
5
use MyCLabs\Enum\Enum;
6
7
/**
8
 * @method static LOW()
9
 * @method static MEDIUM()
10
 * @method static HIGH()
11
 */
12
class NoiseLevel extends Enum
13
{
14
    const LOW = 'low';
15
16
    const MEDIUM = 'medium';
17
18
    const HIGH = 'high';
19
20
    public function isLowerOrEqual(self $other): bool
21
    {
22
        if (self::HIGH() == $other) {
23
            return true;
24
        }
25
26
        if (self::MEDIUM() == $other) {
27
            return in_array($this, [self::MEDIUM(), self::LOW()]);
28
        }
29
30
        return self::LOW() == $this;
31
    }
32
}
33