isSpecialCaseOfLessThanOrEqualSpecification()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Larium\Specification;
6
7
class LessThanSpecification extends ValueBoundSpecification
8
{
9
    public function isSatisfiedBy(Candidate $candidate): bool
10
    {
11
        return $candidate->get($this->getAttribute()) < $this->getValue();
12
    }
13
14 1
    public function isSpecialCaseOfLessThanOrEqualSpecification(ValueBoundSpecification $specification): bool
15
    {
16 1
        return $this->getAttribute() === $specification->getAttribute()
17 1
            && $this->getValue() <= $specification->getValue();
18
    }
19
20
    public function isSpecialCaseOfLessThanSpecification(ValueBoundSpecification $specification): bool
21
    {
22
        return $this->isSpecialCaseOfLessThanOrEqualSpecification($specification);
23
    }
24
}
25