| Conditions | 7 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 7.7656 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 70 | protected function handleCallbacks(string $method, array $arguments) |
|
| 32 | { |
||
| 33 | 70 | if (isset($this->route) && method_exists($this->route, $method)) { |
|
| 34 | return $this->route->$method(...$arguments); |
||
| 35 | } |
||
| 36 | |||
| 37 | 70 | if (CallbacksRegistrar::has($method)) { |
|
| 38 | 40 | return $this->constraint |
|
| 39 | 40 | ->bind($method, $arguments); |
|
| 40 | } |
||
| 41 | |||
| 42 | 30 | if ($method == 'or') { |
|
| 43 | 30 | if (count($arguments) == 0 || !is_callable($arguments[0])) { |
|
| 44 | throw new InvalidArgumentException("The 'or' callback expects one parameter of type callable."); |
||
| 45 | } |
||
| 46 | |||
| 47 | 30 | $callback = new GeoCallback('or', $arguments[0]); |
|
| 48 | |||
| 49 | 30 | return $this->constraint->setCallback($callback); |
|
| 50 | } |
||
| 51 | |||
| 52 | throw new BadMethodCallException("Undefined method '$method'"); |
||
| 53 | } |
||
| 55 |