private function dispatch(Dispatcher $dispatcher, $method, $path)
{
$route = $dispatcher->dispatch($method, $path);
$status = array_shift($route);
if (Dispatcher::FOUND === $status) {
return $route;
}
if (Dispatcher::METHOD_NOT_ALLOWED === $status) {
$allowed = array_shift($route);
throw HttpException::methodNotAllowed($path, $method, $allowed);
}
throw HttpException::notFound($path);
}