Code Duplication    Length = 24-24 lines in 2 locations

source/AndCondition.php 1 location

@@ 14-37 (lines=24) @@
11
 * @author stev leibelt <[email protected]>
12
 * @since 2013-06-25
13
 */
14
class AndCondition extends AbstractCondition
15
{
16
    /**
17
     * {$inheritdoc}
18
     */
19
    public function isMet()
20
    {
21
        if ($this->isDisabled()) {
22
            return $this->getReturnValueIfIsDisabled();
23
        } else {
24
            if ($this->items->count() == 0) {
25
                throw new RuntimeException('No items set in this condition.');
26
            }
27
28
            foreach ($this->items as $item) {
29
                if (!$item->isMet()) {
30
                    return false;
31
                }
32
            }
33
34
            return true;
35
        }
36
    }
37
}

source/OrCondition.php 1 location

@@ 14-37 (lines=24) @@
11
 * @author stev leibelt <[email protected]>
12
 * @since 2013-06-25
13
 */
14
class OrCondition extends AbstractCondition
15
{
16
    /**
17
     * {$inheritdoc}
18
     */
19
    public function isMet()
20
    {
21
        if ($this->isDisabled()) {
22
            return $this->getReturnValueIfIsDisabled();
23
        } else {
24
            if ($this->items->count() == 0) {
25
                throw new RuntimeException('No items set in this condition.');
26
            }
27
28
            foreach ($this->items as $item) {
29
                if ($item->isMet()) {
30
                    return true;
31
                }
32
            }
33
34
            return false;
35
        }
36
    }
37
}