public function handle(Request $request)
    {
        if (!$this->booted) {
            $this->bootstrap();
        }

        $this->request = $request;

        try {
            // Route Request
            $req_info = $this->router->matchRequest($request);

            // Resolve Controller
            $resolver = new Resolver();
            $controller = $resolver->resolveController($req_info['_controller']);

            if (false === $controller) {
                throw new Exception(sprintf('Invalid Controller %s From Route %s', $req_info['_controller'], $req_info['_route']));
            }

            // If the controller is ContainerAware, inject the container
            if ($controller[0] instanceof ContainerAwareInterface) {
                $controller[0]->setContainer($this->container);
            }

            // Build controller method arguments
            $arguments = $resolver->resolveArguments($controller, $request, $req_info);

            // Call controller and get response
            $response = call_user_func_array($controller, $arguments);

            if (!$response instanceof Response) {
                throw new Exception(sprintf('Controller %s did not return a valid Response object.', $req_info['_controller']));
            }

        } catch (\Exception $e) {
            $response = $this->handleException($e);
        }

        return($response);
    }
public function handle(Request $request)
    {
        if (!$this->booted) {
            $this->bootstrap();
        }

        $this->request = $request;

        try {
            // Route Request
            $req_info = $this->router->matchRequest($request);

            // Resolve Controller
            $resolver = new Resolver();
            $controller = $resolver->resolveController($req_info['_controller']);

            if (false === $controller) {
                throw new Exception(sprintf('Invalid Controller %s From Route %s', $req_info['_controller'], $req_info['_route']));
            }

            // If the controller is ContainerAware, inject the container
            if ($controller[0] instanceof ContainerAwareInterface) {
                $controller[0]->setContainer($this->container);
            }

            // Build controller method arguments
            $arguments = $resolver->resolveArguments($controller, $request, $req_info);

            // Call controller and get response
            $response = call_user_func_array($controller, $arguments);

            if (!$response instanceof Response) {
                throw new Exception(sprintf('Controller %s did not return a valid Response object.', $req_info['_controller']));
            }

        } catch (\Exception $e) {
            $response = $this->handleException($e);
        }

        return($response);
    }
public function handle ( Request $ request ) { if ( ! $ this -> booted ) { $ this -> bootstrap ( ) ; } $ this -> request = $ request ; try { // Route Request $ req_info = $ this -> router -> matchRequest ( $ request ) ; // Resolve Controller $ resolver = new Resolver ( ) ; $ controller = $ resolver -> resolveController ( $ req_info [ '_controller' ] ) ; if ( false === $ controller ) { throw new Exception ( sprintf ( 'Invalid Controller %s From Route %s' , $ req_info [ '_controller' ] , $ req_info [ '_route' ] ) ) ; } // If the controller is ContainerAware, inject the container if ( $ controller [ 0 ] instanceof ContainerAwareInterface ) { $ controller [ 0 ] -> setContainer ( $ this -> container ) ; } // Build controller method arguments $ arguments = $ resolver -> resolveArguments ( $ controller , $ request , $ req_info ) ; // Call controller and get response $ response = call_user_func_array ( $ controller , $ arguments ) ; if ( ! $ response instanceof Response ) { throw new Exception ( sprintf ( 'Controller %s did not return a valid Response object.' , $ req_info [ '_controller' ] ) ) ; } } catch ( \ Exception $ e ) { $ response = $ this -> handleException ( $ e ) ; } return ( $ response ) ; }
handle
The main application handler.

@param Symfony\Component\HttpFoundation\Request $request
@return Symfony\Component\HttpFoundation\Response $response
handle The main application handler .