Dietcube\Dispatcher::dispatchRouter PHP Method

dispatchRouter() protected method

Dispatch router with HTTP request information.
protected dispatchRouter ( $method, $path ) : array
$method
$path
return array
    protected function dispatchRouter($method, $path)
    {
        $router = $this->container['router'];
        $logger = $this->container['logger'];
        $logger->debug('Router dispatch.', ['method' => $method, 'path' => $path]);
        $router->init();
        $route_info = $router->dispatch($method, $path);
        $handler = null;
        $vars = [];
        switch ($route_info[0]) {
            case RouteDispatcher::NOT_FOUND:
                $logger->debug('Routing failed. Not Found.');
                throw new HttpNotFoundException('404 Not Found');
                break;
            case RouteDispatcher::METHOD_NOT_ALLOWED:
                $logger->debug('Routing failed. Method Not Allowd.');
                throw new HttpMethodNotAllowedException('405 Method Not Allowed');
                break;
            case RouteDispatcher::FOUND:
                $handler = $route_info[1];
                $vars = $route_info[2];
                $logger->debug('Route found.', ['handler' => $handler]);
                break;
        }
        return [$handler, $vars];
    }