AbstractCondition   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
dl 0
loc 29
wmc 5
lcom 0
cbo 2
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A _and() 0 4 1
A _or() 0 4 1
A __call() 0 16 3
1
<?php
2
3
namespace Muffin\Conditions;
4
5
use Muffin\Condition;
6
7
abstract class AbstractCondition implements Condition
8
{
9 20
    public function _and(Condition $condition)
10
    {
11 20
        return new Binaries\AndCondition($this, $condition);
12
    }
13
14 12
    public function _or(Condition $condition)
15
    {
16 12
        return new Binaries\OrCondition($this, $condition);
17
    }
18
19 30
    public function __call($methodName, $arguments)
20
    {
21 30
        $method = '_' . $methodName;
22
23 30
        if(method_exists($this, $method))
24 30
        {
25 28
            if(array_key_exists(0, $arguments))
26 28
            {
27 27
                return $this->$method($arguments[0]);
28
            }
29
30 1
            throw new \RuntimeException(sprintf("Missing parameter 1 for %s", $method));
31
        }
32
33 2
        throw new \LogicException(sprintf("Unkown method %s", $method));
34
    }
35
}
36