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