Code Duplication    Length = 30-30 lines in 2 locations

src/AndSpecification.php 1 location

@@ 5-34 (lines=30) @@
2
3
namespace Tanigami\Specification;
4
5
class AndSpecification extends Specification
6
{
7
    /**
8
     * @var Specification
9
     */
10
    private $one;
11
12
    /**
13
     * @var Specification
14
     */
15
    private $other;
16
17
    /**
18
     * @param Specification $one
19
     * @param Specification $other
20
     */
21
    public function __construct(Specification $one, Specification $other)
22
    {
23
        $this->one   = $one;
24
        $this->other = $other;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function isSatisfiedBy($object): bool
31
    {
32
        return $this->one->isSatisfiedBy($object) && $this->other->isSatisfiedBy($object);
33
    }
34
}
35

src/OrSpecification.php 1 location

@@ 5-34 (lines=30) @@
2
3
namespace Tanigami\Specification;
4
5
class OrSpecification extends Specification
6
{
7
    /**
8
     * @var Specification
9
     */
10
    private $one;
11
12
    /**
13
     * @var Specification
14
     */
15
    private $other;
16
17
    /**
18
     * @param Specification $one
19
     * @param Specification $other
20
     */
21
    public function __construct(Specification $one, Specification $other)
22
    {
23
        $this->one   = $one;
24
        $this->other = $other;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function isSatisfiedBy($object): bool
31
    {
32
        return $this->one->isSatisfiedBy($object) || $this->other->isSatisfiedBy($object);
33
    }
34
}
35