| Total Complexity | 4 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 19 | trait InvalidRouteErrorHandler |
||
| 20 | { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Method wich handles invalid route error |
||
| 24 | * |
||
| 25 | * @var ?callable |
||
| 26 | */ |
||
| 27 | private $invalidRouteErrorHandler = null; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Method processes no processor found error |
||
| 31 | * |
||
| 32 | * @param string $route |
||
| 33 | * route |
||
| 34 | */ |
||
| 35 | public function noProcessorFoundErrorHandler(string $route): void |
||
| 36 | { |
||
| 37 | throw (new \Exception('The processor was not found for the route ' . $route . ' in ' . $this->getAllRoutesTrace(), -1)); |
||
|
|
|||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Method sets InvalidRouteErrorHandler function |
||
| 42 | * |
||
| 43 | * @param callable $function |
||
| 44 | * error handler |
||
| 45 | * |
||
| 46 | * @return ?callable old error handler |
||
| 47 | */ |
||
| 48 | public function setNoProcessorFoundErrorHandler(callable $function): ?callable |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Method returns error handler |
||
| 59 | * |
||
| 60 | * @return callable |
||
| 61 | */ |
||
| 62 | public function getNoProcessorErrorHandler(): callable |
||
| 74 |