Conditions | 6 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | 4 | public function createGetFromModelClosure() |
|
39 | { |
||
40 | return function(PropRule $propRule, $dataKey){ |
||
41 | 2 | $getter = $propRule->getGet(); |
|
42 | 2 | $propVal = $propRule->getProp($dataKey); |
|
43 | 2 | $val = null; |
|
44 | |||
45 | 2 | if ($getter !== null) { |
|
46 | 2 | $method = is_array($getter) ? $getter[0] : $getter; |
|
47 | 2 | $args = is_array($getter) ? $getter[1] : []; |
|
48 | 2 | $val = call_user_func_array([$this, $method], $args); |
|
49 | 2 | } elseif ($propVal !== null && property_exists($this, $propVal)) { |
|
50 | 2 | $val = $this->{$propVal}; |
|
51 | } |
||
52 | |||
53 | 2 | return $val; |
|
54 | 4 | }; |
|
55 | } |
||
56 | |||
70 |