LessThanSpecification   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 18
ccs 3
cts 7
cp 0.4286
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isSatisfiedBy() 0 4 1
A isSpecialCaseOfLessThanOrEqualSpecification() 0 5 2
A isSpecialCaseOfLessThanSpecification() 0 4 1
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