Conditions | 5 |
Paths | 1 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
31 | 5 | protected function createGetFromModelClosure(): \Closure |
|
32 | { |
||
33 | return function($getter, $propVal) { |
||
34 | 4 | $val = null; |
|
35 | |||
36 | 4 | if ($getter !== null) { |
|
37 | 4 | $method = is_array($getter) ? $getter[0] : $getter; |
|
38 | 4 | $args = is_array($getter) ? $getter[1] : []; |
|
39 | 4 | $val = call_user_func_array([$this, $method], $args); |
|
40 | 4 | } elseif (property_exists($this, $propVal)) { |
|
41 | 4 | $val = $this->{$propVal}; |
|
42 | } |
||
43 | |||
44 | 4 | return $val; |
|
45 | 5 | }; |
|
46 | } |
||
47 | |||
57 |