Completed
Push — master ( d366a2...854d4a )
by brian
01:55
created

GreaterOrEqualTo::__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
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
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\Comparator;
13
14
use ptlis\SemanticVersion\Version\VersionInterface;
15
16
/**
17
 * Version greater than equal or comparator.
18
 */
19
final class GreaterOrEqualTo implements ComparatorInterface
20
{
21
    /**
22
     * Return true if the left version is greater or equal to the right version.
23
     *
24
     * @param VersionInterface $lVersion
25
     * @param VersionInterface $rVersion
26
     *
27
     * @return boolean
28
     */
29 21
    public function compare(VersionInterface $lVersion, VersionInterface $rVersion)
30
    {
31
        return (
32 21
            (new GreaterThan())->compare($lVersion, $rVersion)
33 21
            || (new EqualTo())->compare($lVersion, $rVersion)
34
        );
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function __toString()
41
    {
42 1
        return '>=';
43
    }
44
}
45