public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
    {
        // Passes the request to the container
        $this->getContainer()->add('Symfony\Component\HttpFoundation\Request', $request);

        try {
            $this->emit('request.received', $request);

            $dispatcher = $this->getRouter()->getDispatcher();
            $response = $dispatcher->dispatch(
                $request->getMethod(),
                $request->getPathInfo()
            );

            $this->emit('response.created', $request, $response);

            return $response;

        } catch (\Exception $e) {
            if (!$catch) {
                throw $e;
            }

            $response = call_user_func($this->exceptionDecorator, $e);
            if (!$response instanceof Response) {
                throw new \LogicException(
                    'Exception decorator did not return an instance of Symfony\Component\HttpFoundation\Response'
                );
            }

            $this->emit('response.created', $request, $response);

            return $response;
        }
    }
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
    {
        // Passes the request to the container
        $this->getContainer()->add('Symfony\Component\HttpFoundation\Request', $request);

        try {
            $this->emit('request.received', $request);

            $dispatcher = $this->getRouter()->getDispatcher();
            $response = $dispatcher->dispatch(
                $request->getMethod(),
                $request->getPathInfo()
            );

            $this->emit('response.created', $request, $response);

            return $response;

        } catch (\Exception $e) {
            if (!$catch) {
                throw $e;
            }

            $response = call_user_func($this->exceptionDecorator, $e);
            if (!$response instanceof Response) {
                throw new \LogicException(
                    'Exception decorator did not return an instance of Symfony\Component\HttpFoundation\Response'
                );
            }

            $this->emit('response.created', $request, $response);

            return $response;
        }
    }
public function handle ( Request $ request , $ type = self :: MASTER_REQUEST , $ catch = true ) { // Passes the request to the container $ this -> getContainer ( ) -> add ( 'Symfony\Component\HttpFoundation\Request' , $ request ) ; try { $ this -> emit ( 'request.received' , $ request ) ; $ dispatcher = $ this -> getRouter ( ) -> getDispatcher ( ) ; $ response = $ dispatcher -> dispatch ( $ request -> getMethod ( ) , $ request -> getPathInfo ( ) ) ; $ this -> emit ( 'response.created' , $ request , $ response ) ; return $ response ; } catch ( \ Exception $ e ) { if ( ! $ catch ) { throw $ e ; } $ response = call_user_func ( $ this -> exceptionDecorator , $ e ) ; if ( ! $ response instanceof Response ) { throw new \ LogicException ( 'Exception decorator did not return an instance of Symfony\Component\HttpFoundation\Response' ) ; } $ this -> emit ( 'response.created' , $ request , $ response ) ; return $ response ; } }
Handle the request.

@param \Symfony\Component\HttpFoundation\Request $request
@param int $type
@param bool $catch

@throws \Exception
@throws \LogicException

@return \Symfony\Component\HttpFoundation\Response
Handle the request .