FluxBB\Web\Router::getCallable PHP Method

getCallable() public method

public getCallable ( $method, $uri )
    public function getCallable($method, $uri)
    {
        $routeInfo = $this->getDispatcher()->dispatch($method, $uri);
        switch ($routeInfo[0]) {
            case Dispatcher::NOT_FOUND:
                throw new \Exception('404 Not Found');
            case Dispatcher::METHOD_NOT_ALLOWED:
                throw new \Exception('405 Method Not Allowed');
            case Dispatcher::FOUND:
                $handler = $routeInfo[1];
                $parameters = $routeInfo[2];
                return [$handler, $parameters];
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Get the class of the controller to be executed.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @return string
  */
 protected function getCallable(Request $request)
 {
     $method = $request->getMethod();
     $uri = $request->getPathInfo();
     return $this->router->getCallable($method, $uri);
 }