当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpKernelInterface::terminate方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpKernel\HttpKernelInterface::terminate方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpKernelInterface::terminate方法的具体用法?PHP HttpKernelInterface::terminate怎么用?PHP HttpKernelInterface::terminate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpKernel\HttpKernelInterface的用法示例。


在下文中一共展示了HttpKernelInterface::terminate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: terminate

 /**
  * {@inheritdoc}
  */
 public function terminate(Request $request, Response $response)
 {
     parent::terminate($request, $response);
     if ($this->app instanceof TerminableInterface) {
         $this->app->terminate($request, $response);
     }
 }
开发者ID:phramz,项目名称:staticfiles-middleware,代码行数:10,代码来源:HttpServer.php

示例2: onRequest

 /**
  * Handle a request using a HttpKernelInterface implementing application.
  *
  * @param \React\Http\Request $request
  * @param \React\Http\Response $response
  */
 public function onRequest(ReactRequest $request, ReactResponse $response)
 {
     if (null === $this->application) {
         return;
     }
     $content = '';
     $headers = $request->getHeaders();
     $contentLength = isset($headers['Content-Length']) ? (int) $headers['Content-Length'] : 0;
     $request->on('data', function ($data) use($request, $response, &$content, $contentLength) {
         // read data (may be empty for GET request)
         $content .= $data;
         // handle request after receive
         if (strlen($content) >= $contentLength) {
             $syRequest = self::mapRequest($request, $content);
             try {
                 $syResponse = $this->application->handle($syRequest);
             } catch (\Exception $exception) {
                 $response->writeHead(500);
                 // internal server error
                 $response->end();
                 return;
             }
             self::mapResponse($response, $syResponse);
             if ($this->application instanceof TerminableInterface) {
                 $this->application->terminate($syRequest, $syResponse);
             }
         }
     });
 }
开发者ID:nghenglim,项目名称:php-pm-httpkernel,代码行数:35,代码来源:HttpKernel.php

示例3: terminate

 /**
  * @param Request  $request
  * @param Response $response
  */
 public function terminate(Request $request, Response $response)
 {
     $this->newRelic->endOfTransaction();
     if ($this->app instanceof TerminableInterface) {
         $this->app->terminate($request, $response);
     }
 }
开发者ID:evaneos,项目名称:pyrite,代码行数:11,代码来源:NewrelicMiddleware.php

示例4: onRequest

 /**
  * Handle a request
  *
  * @param ReactRequest  $request
  * @param ReactResponse $response
  */
 public function onRequest(ReactRequest $request, ReactResponse $response)
 {
     $content = '';
     $headers = $request->getHeaders();
     $contentLength = isset($headers['Content-Length']) ? (int) $headers['Content-Length'] : 0;
     $request->on('data', function ($data) use($request, $response, &$content, $contentLength) {
         // Read data (may be empty for GET request)
         $content .= $data;
         // Handle request after receive
         if (strlen($content) >= $contentLength) {
             $symfonyRequest = static::mapRequest($request, $content);
             try {
                 // Execute
                 $symfonyResponse = $this->application->handle($symfonyRequest);
             } catch (\Throwable $t) {
                 // Executed only in PHP 7, will not match in PHP 5.x
                 $this->fatalError($response, $t);
                 return;
             } catch (\Exception $e) {
                 // Executed only in PHP 5.x, will not be reached in PHP 7
                 $this->fatalError($response, $e);
                 return;
             }
             static::mapResponse($response, $symfonyResponse);
             if ($this->application instanceof SymfonyHttpKernel\TerminableInterface) {
                 $this->application->terminate($symfonyRequest, $symfonyResponse);
             }
         }
     });
 }
开发者ID:M6Web,项目名称:PhpProcessManagerBundle,代码行数:36,代码来源:HttpKernel.php

示例5: terminate

 /**
  * @param Request  $request
  * @param Response $response
  */
 public function terminate(Request $request, Response $response)
 {
     $logger = $this->loggerFactory->create('app.request');
     $routeName = $request->attributes->get('_route');
     $logger->notice(sprintf('Route %s matched', $routeName), array('route' => $routeName, 'response_code' => $response->getStatusCode(), 'response_size' => strlen($response->getContent())));
     $this->loggerFactory->flushBuffer();
     if ($this->app instanceof TerminableInterface) {
         $this->app->terminate($request, $response);
     }
 }
开发者ID:evaneos,项目名称:pyrite,代码行数:14,代码来源:LoggerMiddleware.php

示例6: terminate

 public function terminate(Request $request, Response $response)
 {
     foreach ($this->map as $path => $app) {
         if ($app instanceof TerminableInterface) {
             $app->terminate($request, $response);
         }
     }
     if ($this->app instanceof TerminableInterface) {
         $this->app->terminate($request, $response);
     }
 }
开发者ID:digitalkaoz,项目名称:url-map,代码行数:11,代码来源:UrlMap.php

示例7: run

function run(HttpKernelInterface $app, Request $request = null)
{
    $request = $request ?: Request::createFromGlobals();
    $response = $app->handle($request);
    $response->send();
    if ($app instanceof TerminableInterface) {
        $app->terminate($request, $response);
    }
}
开发者ID:J7mbo,项目名称:run,代码行数:9,代码来源:run.php

示例8: doRun

 /**
  * @param Request $request
  * @param         $type
  */
 private function doRun(Request $request, $type)
 {
     if (false === $this->isResolved) {
         $this->resolvedApp = $this->builder->resolve($this);
         $this->isResolved = true;
     }
     $request = $request ?: Request::createFromGlobals();
     $response = $this->resolvedApp->handle($request, $type);
     $response->send();
     if ($this->resolvedApp instanceof TerminableInterface) {
         $this->resolvedApp->terminate($request, $response);
     }
 }
开发者ID:evaneos,项目名称:pyrite,代码行数:17,代码来源:PyriteKernel.php

示例9: terminate

 /**
  * Terminates the request/response cycle
  *
  * @param Request  $request  The request
  * @param Response $response The response
  *
  * @return void
  */
 public function terminate(Request $request, Response $response)
 {
     if ($this->kernel instanceof TerminableInterface) {
         $this->kernel->terminate($request, $response);
     }
 }
开发者ID:novuso,项目名称:NovusoCommonBundle,代码行数:14,代码来源:ContentNegotiation.php

示例10: terminate

 /**
  * Terminates a request/response cycle.
  *
  * @param SyfmonyRequest $request A Request instance
  * @param Response $response A Response instance
  *
  * @api
  */
 public function terminate(SyfmonyRequest $request, Response $response)
 {
     $this->httpKernel->terminate(Request::createFromBase($request), $response);
 }
开发者ID:codeception,项目名称:base,代码行数:12,代码来源:Laravel5.php

示例11: terminate

 /**
  * Terminates a request/response cycle.
  *
  * @param Request  $request
  * @param Response $response
  */
 public function terminate(Request $request, Response $response)
 {
     $this->kernel->terminate($request, $response);
 }
开发者ID:jacobjjc,项目名称:PageKit-framework,代码行数:10,代码来源:Router.php

示例12: terminate

 /**
  * Terminates a request/response cycle.
  *
  * @param DomRequest $request A Request instance
  * @param Response $response A Response instance
  *
  * @api
  */
 public function terminate(DomRequest $request, Response $response)
 {
     $this->httpKernel->terminate($request, $response);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:12,代码来源:Laravel5.php


注:本文中的Symfony\Component\HttpKernel\HttpKernelInterface::terminate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。