rpc response.

@param \Lia\Addons\Terminal\Kernel $kernel
@return \Illuminate\Http\JsonResponse
512866
public function endpoint(Kernel $kernel)
    {
        $error = $kernel->call(
            $this->request->get('command'),
            $this->request->get('parameters', [])
        );

        $key = $error === 0 ? 'result' : 'error';

        return $this->responseFactory->json([
            'jsonrpc' => $this->request->get('jsonrpc'),
            'id' => $this->request->get('id'),
            $key => $kernel->output(),
        ]);
    }
744291
public function handle(Application $app, Kernel $kernel)
    {
        if (! $app->routesAreCached()) {
            return;
        }

        $app->terminating(function () use ($kernel) {
            $kernel->call('route:cache');
        });
    }
365821
public function send(Request $request)
    {
        $response   = new GetResponse();
        $rpbGetReq  = $this->createRpbMessage($request);
        $rpbGetResp = $this->client->send($rpbGetReq, RiakMessageCodes::GET_REQ, RiakMessageCodes::GET_RESP);

        if ( ! $rpbGetResp instanceof RpbGetResp) {
            return $response;
        }

        if ( ! $rpbGetResp->hasContent()) {
            return $response;
        }

        $response->vClock      = $rpbGetResp->getVclock()->get();
        $response->contentList = $this->createContentList($rpbGetResp->getContentList());

        return $response;
    }
1059160
public function boot(): KernelInterface
    {
        if (! $this->isBooted) {
            foreach ($this->serviceProviders as $provider) {
                $this->bootProvider($provider);
            }
            $this->isBooted = true;
        }

        return $this;
    }
539330
public function register(KernelInterface $kernel): void
    {
        /*
        $kernel[ServerRequestCreatorInterface::class] = function ($c) {
            $requestCreator = new ServerRequestCreator(
                $c[ServerRequestFactoryInterface::class],
                $c[UriFactoryInterface::class],
                $c[UploadedFileFactoryInterface::class],
                $c[StreamFactoryInterface::class]);

            return $requestCreator->fromGlobals();
        };*/


        $kernel->closure(ServerRequestCreatorInterface::class, function (ServerRequestFactoryInterface $serverRequestFactory, UriFactoryInterface $uriFactory, UploadedFileFactoryInterface $uploadedFileFactory, StreamFactoryInterface $streamFactory) {
            $requestCreator = new ServerRequestCreator(
                $serverRequestFactory,
                $uriFactory,
                $uploadedFileFactory,
                $streamFactory);

            return $requestCreator->fromGlobals();
        });



        // *** register alias ***
        $kernel->alias(ServerRequestCreator::class, ServerRequestCreatorInterface::class);
        $kernel->alias('request', ServerRequestCreatorInterface::class);
        /*
        $kernel[ServerRequestCreator::class] = function ($c) {
            return $c->get(ServerRequestCreatorInterface::class);
        };

        $kernel['request'] = function ($c) {
            return $c->get(ServerRequestCreatorInterface::class);
        };*/
    }
1268583
static private function _process(\Lollipop\HTTP\Request $req, \Lollipop\HTTP\Response $res) {
        if (is_null(self::$_kernel)) {
            $active = self::$_active_route;
            $top = function(\Lollipop\HTTP\Request $req, \Lollipop\HTTP\Response $res) use ($active) {
                return Route::resolve($active['callback'], $req, $res, $active['arguments']);
            };
            self::$_kernel = $top;
        }
        
        // Create a new address for the top callable
        $start = self::$_kernel;
        
        // Start dequeue
        self::$_busy = true;
        $new_response = $start($req, $res);
        self::$_busy = false;
        
        // Just want to make sure that processed response from middlewares
        // are instance of \Calf\HTTP\Response
        if ($new_response instanceof \Lollipop\HTTP\Response) {
            $res = $new_response;
        } else {
            $res->set($new_response);
        }

        return $res;
    }
619872
public function toResponse($request): JsonResponse
    {
        return response()->json([
            'success' => $this->result,
            'message' => ($this->result)
                ? trans('comments::messages.send_success')
                : trans('comments::messages.send_fail'),
        ]);
    }
689956
public function boot(Kernel $kernel)
    {
        if ($this->app->isLocal()) {
            $kernel->pushMiddleware('Laracasts\Matryoshka\FlushViews');
        }

        Blade::directive('cache', function ($expression) {
            $version = explode('.', $this->app::VERSION);
            // Starting with laravel 5.3 the parens are not included in the expression string.
            if ($version[1] > 2) {
                return "<?php if (! app('Laracasts\Matryoshka\BladeDirective')->setUp({$expression})) : ?>";
            }
            return "<?php if (! app('Laracasts\Matryoshka\BladeDirective')->setUp{$expression}) : ?>";
        });

        Blade::directive('endcache', function () {
            return "<?php endif; echo app('Laracasts\Matryoshka\BladeDirective')->tearDown() ?>";
        });
    }
338611
public function onKernelResponse(KernelEvent $event)
    {
        if ($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST
            && $this->wasTxStarted
            && $this->doctrine->getConnection()->getTransactionIsolation() > 0) {

            if ($this->doctrine->getConnection()->isRollbackOnly()) {
                $this->doctrine->getConnection()->rollback();
            } else {
                $this->doctrine->getConnection()->commit();
            }
            $this->wasTxStarted = false;
        }
    }
1055493
public function completedResponse(JsonResponse $response)
    {
        $data = $response->getData();
        $response->setData([
            'jsonrpc' => '2.0',
            'result' => $data,
        ]);

        return $response;
    }
1260129
private function handleResponse()
    {
        if (!$this->processor->error) {
            return $this->processor->response;
        }
        $error_message = null;
        $error_code    = null;
        if ($this->processor->error_code) {
            $error_message = $this->processor->error_message;
            $error_code    = $this->processor->error_code;
            if (empty($error_message)) {
                $response = json_decode($this->processor->response);
                $error_message = sprintf('(%u) %s: %s', $response->status, $response->reason, $response->message);
            }
        }
        throw new AuthnetCurlException(sprintf('Connection error: %s (%s)', $error_message, $error_code));
    }
1295109
public function listAction($context = null)
    {
        return new JsonResponse([
            'widgets' => array_map(function (Widget $widget) {
                return $this->serializer->serialize($widget);
            }, $this->widgetManager->getAvailable($context)),
            'dataSources' => array_map(function (DataSource $dataSource) {
                return $this->serializer->serialize($dataSource);
            }, $this->dataSourceManager->getAvailable($context)),
        ]);
    }
562165
public function getContent(): Response {
        $uri     = $this->fedora->sanitizeUri($this->uri);
        $request = new Request('GET', $uri);
        return $this->fedora->sendRequest($request);
    }
1017242
public function respondWithSuccess(array $data = []): JsonResponse
    {
        return $this->setStatusCode(IlluminateResponse::HTTP_OK)->respond([
            'status' => [
                'http_code' => $this->getStatusCode(),
            ],
            'data' => $data,
        ]);
    }
511841
public function handle(KernelHandleInterface $target, Request $request) {
		$event = new KernelHandleEvent($target);

		$this->dispatcher->dispatch(KernelHandleEvent::PRE_RUN, $event);
		$response = $target->run($request);
		$this->dispatcher->dispatch(KernelHandleEvent::POST_RUN, $event);

		return $response;
	}
523238
public function sendRPC($rpc)
    {

        $this->messageID++;

        return new NetConfMessageRecvRPC(
            $this->sendRaw(
                $rpc, "rpc", "</rpc-reply>",
                ["message-id"=>$this->messageID]
            )
        );

    }
64159
static public function instance( KernelAwareContext $context )
    {
        static $instance = null;
        if ( $instance === null )
        {
            $class = get_called_class();
            $instance = new $class();
            $instance->setContext( $context );
        }

        return $instance;
    }