Code Duplication    Length = 46-46 lines in 2 locations

src/Oro/Component/ConfigExpression/Condition/FalseCondition.php 1 location

@@ 10-55 (lines=46) @@
7
/**
8
 * Implements logical FALSE constant.
9
 */
10
class FalseCondition extends AbstractCondition
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function getName()
16
    {
17
        return 'false';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function toArray()
24
    {
25
        return $this->convertToArray(null);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function compile($factoryAccessor)
32
    {
33
        return $this->convertToPhpCode(null, $factoryAccessor);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function initialize(array $options)
40
    {
41
        if (!empty($options)) {
42
            throw new Exception\InvalidArgumentException('Options are prohibited.');
43
        }
44
45
        return $this;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    protected function isConditionAllowed($context)
52
    {
53
        return false;
54
    }
55
}
56

src/Oro/Component/ConfigExpression/Condition/TrueCondition.php 1 location

@@ 10-55 (lines=46) @@
7
/**
8
 * Implements logical TRUE constant.
9
 */
10
class TrueCondition extends AbstractCondition
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function getName()
16
    {
17
        return 'true';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function toArray()
24
    {
25
        return $this->convertToArray(null);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function compile($factoryAccessor)
32
    {
33
        return $this->convertToPhpCode(null, $factoryAccessor);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function initialize(array $options)
40
    {
41
        if (!empty($options)) {
42
            throw new Exception\InvalidArgumentException('Options are prohibited.');
43
        }
44
45
        return $this;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    protected function isConditionAllowed($context)
52
    {
53
        return true;
54
    }
55
}
56