Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
51 | 31 | protected function performOnSnakeMethod($name, callable $handleInvoke, callable $handleError) |
|
52 | { |
||
53 | 31 | static $class; |
|
54 | 31 | if (!$class) { |
|
55 | 2 | $class = new \ReflectionClass(static::class); |
|
56 | } |
||
57 | 31 | $camel = str_replace('_', '', ucwords($name, '_')); |
|
58 | 31 | if ($class->hasMethod($camel)) { |
|
59 | 31 | $method = $class->getMethod($camel); |
|
60 | 31 | if ($method->isPublic()) { |
|
61 | 31 | return $handleInvoke($method); |
|
62 | } |
||
63 | } |
||
64 | 2 | return $handleError($name); |
|
65 | } |
||
66 | |||
77 |