OrSpecification::isSatisfiedBy()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
nc 2
cc 2
eloc 2
nop 1
crap 2
1
<?php
2
3
namespace RemiSan\Specification;
4
5
class OrSpecification extends AbstractSpecification implements Specification
6
{
7
    /** @var Specification */
8
    private $one;
9
10
    /** @var Specification */
11
    private $other;
12
13
    /**
14
     * Constructor.
15
     *
16
     * @param Specification $one
17
     * @param Specification $other
18
     */
19 18
    public function __construct(Specification $one, Specification $other)
20
    {
21 18
        $this->one = $one;
22 18
        $this->other = $other;
23 18
    }
24
25
    /**
26
     * @param $candidate
27
     *
28
     * @return bool
29
     */
30 12
    public function isSatisfiedBy($candidate)
31
    {
32 12
        return $this->one->isSatisfiedBy($candidate) || $this->other->isSatisfiedBy($candidate);
33
    }
34
}
35