isGeneralizationOfLessThanSpecification()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Larium\Specification;
6
7 View Code Duplication
class LessThanOrEqualSpecification extends ValueBoundSpecification
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    public function isSatisfiedBy(Candidate $candidate): bool
10
    {
11
        return $candidate->get($this->getAttribute()) <= $this->getValue();
12
    }
13
14
    public function isSpecialCaseOfLessThanOrEqualSpecification(ValueBoundSpecification $specification): bool
15
    {
16
        return $this->getAttribute() === $specification->getAttribute()
17
            && $this->getValue() <= $specification->getValue();
18
    }
19
20 1
    public function isSpecialCaseOfLessThanSpecification(ValueBoundSpecification $specification): bool
21
    {
22 1
        return $this->getAttribute() === $specification->getAttribute()
23 1
            && $this->getValue() < $specification->getValue();
24
    }
25
26
    public function isGeneralizationOfLessThanOrEqualSpecification(ValueBoundSpecification $specification): bool
27
    {
28
        return $this->getAttribute() === $specification->getAttribute()
29
            && $this->getValue() >= $specification->getValue();
30
    }
31
32
    public function isGeneralizationOfLessThanSpecification(ValueBoundSpecification $specification): bool
33
    {
34
        return $this->isGeneralizationOfLessThanOrEqualSpecification($specification);
35
    }
36
}
37