Completed
Push — master ( 1d2321...475c0f )
by brian
02:39
created

LogicalAnd::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * @copyright   (c) 2014-2017 brian ridley
5
 * @author      brian ridley <[email protected]>
6
 * @license     http://opensource.org/licenses/MIT MIT
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ptlis\SemanticVersion\VersionRange;
13
14
use ptlis\SemanticVersion\Version\VersionInterface;
15
16
/**
17
 * Version range with a left & right value - both must be true to fulfill the isSatisfiedBy requirement.
18
 */
19
final class LogicalAnd implements VersionRangeInterface
20
{
21
    /**
22
     * @var VersionRangeInterface
23
     */
24
    private $leftRange;
25
26
    /**
27
     * @var VersionRangeInterface
28
     */
29
    private $rightRange;
30
31
32
    /**
33
     * Constructor.
34
     *
35
     * @param VersionRangeInterface $leftRange
36
     * @param VersionRangeInterface $rightRange
37
     */
38 2
    public function __construct(VersionRangeInterface $leftRange, VersionRangeInterface $rightRange)
39
    {
40 2
        $this->leftRange = $leftRange;
41 2
        $this->rightRange = $rightRange;
42 2
    }
43
44
    /**
45
     * {@inheritDoc}
46
     */
47 1
    public function isSatisfiedBy(VersionInterface $version)
48
    {
49 1
        return $this->leftRange->isSatisfiedBy($version) && $this->rightRange->isSatisfiedBy($version);
50
    }
51
52
53
    /**
54
     * {@inheritDoc}
55
     */
56 1
    public function __toString()
57
    {
58 1
        return $this->leftRange . ',' . $this->rightRange;
59
    }
60
}
61