Conditions | 7 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
37 | 6 | public function rules($rules) |
|
38 | { |
||
39 | 6 | foreach ($rules as $ruleType => $params) { |
|
40 | 6 | if (is_array($params)) { |
|
41 | 6 | foreach ($params as $innerParams) { |
|
42 | 6 | if (!is_array($innerParams)) { |
|
43 | 3 | $innerParams = (array)$innerParams; |
|
44 | } |
||
45 | 6 | array_unshift($innerParams, $ruleType); |
|
46 | 6 | call_user_func_array([$this, 'rule'], $innerParams); |
|
47 | 6 | $arguments = array_pop($innerParams); |
|
48 | 6 | if (is_array($arguments) && isset($arguments['message'])) { |
|
49 | 6 | $this->message($arguments['message']); |
|
50 | } |
||
51 | } |
||
52 | } else { |
||
53 | 6 | $this->rule($ruleType, $params); |
|
54 | } |
||
55 | } |
||
56 | } |
||
57 | } |