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