Completed
Pull Request — master (#15)
by
unknown
05:30
created

canBeSatisfiedByAnythingBelow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @copyright 2010-2018 Mike van Riel<[email protected]>
11
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
12
 * @link      http://phpdoc.org
13
 */
14
15
namespace Flyfinder\Specification;
16
17
/**
18
 * Class CompositeSpecification
19
 * Base class for specifications, allows for combining specifications
20
 */
21
abstract class CompositeSpecification implements SpecificationInterface
22
{
23
    /**
24
     * Returns a specification that satisfies the original specification
25
     * as well as the other specification
26
     * @param SpecificationInterface $other
27 1
     * @return AndSpecification
28
     */
29 1
    public function andSpecification(SpecificationInterface $other): AndSpecification
30
    {
31
        return new AndSpecification($this, $other);
32
    }
33
34
    /**
35
     * Returns a specification that satisfies the original specification
36 1
     * or the other specification
37
     * @param SpecificationInterface $other
38 1
     * @return OrSpecification
39
     */
40
    public function orSpecification(SpecificationInterface $other): OrSpecification
41
    {
42
        return new OrSpecification($this, $other);
43
    }
44
45 1
    /**
46
     * Returns a specification that is the inverse of the original specification
47 1
     * i.e. does not meet the original criteria
48
     */
49
    public function notSpecification(): NotSpecification
50
    {
51
        return new NotSpecification($this);
52
    }
53
54
    /** @inheritDoc */
55
    public function canBeSatisfiedByAnythingBelow(array $value): bool
56
    {
57
        return true;
58
    }
59
}
60