AndCondition::isMet()   A
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 18

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
cc 5
nc 5
nop 0
dl 18
loc 18
rs 9.3554
c 0
b 0
f 0
1
<?php
2
3
namespace Net\Bazzline\Component\Requirement;
4
5
use RuntimeException;
6
7
/**
8
 * Class AndCondition
9
 *
10
 * @package Net\Bazzline\Component\Requirement
11
 * @author stev leibelt <[email protected]>
12
 * @since 2013-06-25
13
 */
14 View Code Duplication
class AndCondition extends AbstractCondition
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...
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
}