OrSpecification::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
nc 1
cc 1
eloc 3
nop 2
crap 1
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