src/Colorium/Web/Rest.php
protected function route(Context $context)
    {
        $this->logger->debug('kernel.route: find route from http query');

        // logic already specified
        if($context->logic) {
            $this->logger->debug('kernel.route: forward to #' . $context->logic->name . ', skip routing');
            return $context;
        }

        // find route
        $query = $context->request->method . ' ' . $context->request->uri->path;
        $route = $this->router->find($query);

        // 404
        if(!$route) {
            throw new NotFoundException('No route found for query ' . $query);
        }

        // update context
        $context->route = $route;
        $context->params = $route->params;
        $context->logic = $route->resource;

        $this->logger->debug('kernel.route: #' . $context->logic->name . ' found for query ' . $query);

        return $context;
    }
protected function route(Context $context)
    {
        $this->logger->debug('kernel.route: find route from http query');

        // logic already specified
        if($context->logic) {
            $this->logger->debug('kernel.route: forward to #' . $context->logic->name . ', skip routing');
            return $context;
        }

        // find route
        $query = $context->request->method . ' ' . $context->request->uri->path;
        $route = $this->router->find($query);

        // 404
        if(!$route) {
            throw new NotFoundException('No route found for query ' . $query);
        }

        // update context
        $context->route = $route;
        $context->params = $route->params;
        $context->logic = $route->resource;

        $this->logger->debug('kernel.route: #' . $context->logic->name . ' found for query ' . $query);

        return $context;
    }
protected function route ( Context $ context ) { $ this -> logger -> debug ( 'kernel.route: find route from http query' ) ; // logic already specified if ( $ context -> logic ) { $ this -> logger -> debug ( 'kernel.route: forward to #' . $ context -> logic -> name . ', skip routing' ) ; return $ context ; } // find route $ query = $ context -> request -> method . ' ' . $ context -> request -> uri -> path ; $ route = $ this -> router -> find ( $ query ) ; // 404 if ( ! $ route ) { throw new NotFoundException ( 'No route found for query ' . $ query ) ; } // update context $ context -> route = $ route ; $ context -> params = $ route -> params ; $ context -> logic = $ route -> resource ; $ this -> logger -> debug ( 'kernel.route: #' . $ context -> logic -> name . ' found for query ' . $ query ) ; return $ context ; }
Find route from context

@param Context $context
@return Context

@throws NotFoundException
Find route from context