Passed
Push — master ( bc6688...f0a8fd )
by Dāvis
03:26
created

OrSpecification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 30
loc 30
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A isSatisfiedBy() 3 3 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Sludio\HelperBundle\Script\Specification;
4
5
/**
6
 * Or specification
7
 */
8 View Code Duplication
class OrSpecification extends CompositeSpecification
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var SpecificationInterface One specification
12
     */
13
    private $one;
14
    
15
    /**
16
     * @var SpecificationInterface Other specification
17
     */
18
    private $other;
19
20
    /**
21
     * Constructor
22
     *
23
     * @param SpecificationInterface $one
24
     * @param SpecificationInterface $other
25
     */
26
    public function __construct(SpecificationInterface $one, SpecificationInterface $other)
27
    {
28
        $this->one = $one;
29
        $this->other = $other;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function isSatisfiedBy($object)
36
    {
37
        return $this->one->isSatisfiedBy($object) || $this->other->isSatisfiedBy($object);
38
    }
39
}