Code Duplication    Length = 23-23 lines in 2 locations

Relation/ExcludeRelation.php 1 location

@@ 17-39 (lines=23) @@
14
/**
15
 * This class represents "exclude" relation.
16
 */
17
class ExcludeRelation implements RelationInterface
18
{
19
    /**
20
     * @var string[]
21
     */
22
    private $names;
23
24
    /**
25
     * @param array $names
26
     */
27
    public function __construct(array $names = [])
28
    {
29
        $this->names = array_flip($names);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function isRelated($name)
36
    {
37
        return !isset($this->names[$name]);
38
    }
39
}
40

Relation/IncludeRelation.php 1 location

@@ 17-39 (lines=23) @@
14
/**
15
 * This class represents "include" relation.
16
 */
17
class IncludeRelation implements RelationInterface
18
{
19
    /**
20
     * @var string[]
21
     */
22
    private $names;
23
24
    /**
25
     * @param array $names
26
     */
27
    public function __construct(array $names = [])
28
    {
29
        $this->names = array_flip($names);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function isRelated($name)
36
    {
37
        return isset($this->names[$name]);
38
    }
39
}
40