isGeneralizationOfGreaterThanSpecification()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Larium\Specification;
6
7 View Code Duplication
class GreaterThanSpecification 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 1
    public function isSatisfiedBy(Candidate $candidate): bool
10
    {
11 1
        return $candidate->get($this->getAttribute()) > $this->getValue();
12
    }
13
14 1
    public function isSpecialCaseOfGreaterThanOrEqualSpecification(ValueBoundSpecification $specification): bool
15
    {
16 1
        return $this->getAttribute() === $specification->getAttribute()
17 1
            && $this->getValue() >= $specification->getValue();
18
    }
19
20
    public function isSpecialCaseOfGreaterThanSpecification(ValueBoundSpecification $specification): bool
21
    {
22
        return $this->isSpecialCaseOfGreaterThanOrEqualSpecification($specification);
23
    }
24
25 1
    public function isGeneralizationOfGreaterThanOrEqualSpecification(ValueBoundSpecification $specification): bool
26
    {
27 1
        return $this->getAttribute() === $specification->getAttribute()
28 1
            && $this->getValue() <= $specification->getValue();
29
    }
30
31
    public function isGeneralizationOfGreaterThanSpecification(ValueBoundSpecification $specification): bool
32
    {
33
        return $this->getAttribute() === $specification->getAttribute()
34
            && $this->getValue() < $specification->getValue();
35
    }
36
}
37