protected function run(Data $data)
    {
        $this->router->getContext()->setMethod($data->getMethod());
        $fullUri = $data->getFullUri();

        try {
            $route = $this->router->match($fullUri);
        } catch (ResourceNotFoundException $exception) {
            $route['_route'] = $fullUri;
        }

        if (!empty($route['path'])) {
            $route = $this->router->match($route['path']);
        }

        $kernel = clone $this->kernel;
        $request = $this->request($data, $route);
        $response = $kernel->handle($request);
        $kernel->terminate($request, $response);
        $kernel->shutdown();

        unset(
            $kernel,
            $request,
            $route
        );

        return $response;
    }
protected function run(Data $data)
    {
        $this->router->getContext()->setMethod($data->getMethod());
        $fullUri = $data->getFullUri();

        try {
            $route = $this->router->match($fullUri);
        } catch (ResourceNotFoundException $exception) {
            $route['_route'] = $fullUri;
        }

        if (!empty($route['path'])) {
            $route = $this->router->match($route['path']);
        }

        $kernel = clone $this->kernel;
        $request = $this->request($data, $route);
        $response = $kernel->handle($request);
        $kernel->terminate($request, $response);
        $kernel->shutdown();

        unset(
            $kernel,
            $request,
            $route
        );

        return $response;
    }
protected function run ( Data $ data ) { $ this -> router -> getContext ( ) -> setMethod ( $ data -> getMethod ( ) ) ; $ fullUri = $ data -> getFullUri ( ) ; try { $ route = $ this -> router -> match ( $ fullUri ) ; } catch ( ResourceNotFoundException $ exception ) { $ route [ '_route' ] = $ fullUri ; } if ( ! empty ( $ route [ 'path' ] ) ) { $ route = $ this -> router -> match ( $ route [ 'path' ] ) ; } $ kernel = clone $ this -> kernel ; $ request = $ this -> request ( $ data , $ route ) ; $ response = $ kernel -> handle ( $ request ) ; $ kernel -> terminate ( $ request , $ response ) ; $ kernel -> shutdown ( ) ; unset ( $ kernel , $ request , $ route ) ; return $ response ; }
Execute request in Kernel

@param Data $data
@return Response
@throws \Garlic\Bus\Exceptions\FileUploadException
Execute request in Kernel