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


PHP Kernel::handle方法代码示例

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


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

示例1: saveTokenAction

 /**
  * @return \Symfony\Component\HttpFoundation\Response $response
  */
 public function saveTokenAction()
 {
     if (!$this->request->query->has('oauth_token') || !$this->request->query->has('oauth_verifier')) {
         return $this->goToSettingsAction();
     }
     $path['_controller'] = 'weaving_the_web_user.controller.twitter:getAccessTokenAction';
     $subRequest = $this->request->duplicate(['oauth_token' => $this->request->get('oauth_token'), 'oauth_verifier' => $this->request->get('oauth_verifier')], null, $path);
     /**
      * @var \Symfony\Component\HttpFoundation\Response $response
      */
     $response = $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     $content = $response->getContent();
     $tokenParameters = json_decode($content, true);
     if (json_last_error() !== JSON_ERROR_NONE) {
         return $this->goToSettingsAction();
     }
     $this->persistToken($tokenParameters);
     $subRequest = $this->request->duplicate(null, null, ['_controller' => 'weaving_the_web_user.controller.settings:showAction']);
     return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
 }
开发者ID:WeavingTheWeb,项目名称:devobs,代码行数:23,代码来源:SettingsController.php

示例2: handleRequest

 /**
  * {@inheritdoc}
  */
 public function handleRequest(RequestInterface $request)
 {
     $symfonyRequest = $request->getHttpFoundationRequest();
     $symfonyResponse = $this->kernel->handle($symfonyRequest);
     $this->kernel->terminate($symfonyRequest, $symfonyResponse);
     return $symfonyResponse;
 }
开发者ID:hason,项目名称:SpeedfonyBundle,代码行数:10,代码来源:KernelWrapper.php

示例3: replay

 public function replay(Request $baseRequest, Notification $notification)
 {
     $webHook = $notification->getWebHook();
     $endpoint = $webHook->getEndpoint();
     $content = json_decode($notification->getContent(), true);
     $query = array_merge(['username' => $webHook->getUser()->getUsername(), 'endpoint' => $endpoint], $content['query']);
     $url = $this->router->generate('notifications', $query);
     $request = Request::create($url, $content['method'], [], [], [], $baseRequest->server->all(), $content['body']);
     $request->headers->replace($content['headers']);
     $response = $this->kernel->handle($request, HttpKernelInterface::SUB_REQUEST);
     return $response;
 }
开发者ID:localhook,项目名称:localhook-server,代码行数:12,代码来源:RequestSimulator.php

示例4: handle

 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     $isUserHashRequest = $this->isUserHashRequest($request);
     if ($isUserHashRequest && !$this->canGenerateUserHash($request)) {
         return new Response('', 405);
     } else {
         if ($isUserHashRequest && !$this->generatingUserHash) {
             return new Response('', 200, array('X-User-Hash' => $this->generateUserHash($request)));
         }
     }
     return parent::handle($request, $type, $catch);
 }
开发者ID:masev,项目名称:ezpublish-kernel,代码行数:12,代码来源:Kernel.php

示例5: renderWithParameters

 /**
  * Renders the given route with the given parameter.
  *
  * @param Route  $route     Route.
  * @param string $name      Name of the route; the default value is `null`.
  * @param array  $parameter Array of parameters; the default value is an empty array.
  *
  * @return void
  */
 protected function renderWithParameters(Route $route, $name = null, array $parameter = array())
 {
     $request = $this->buildRequest($route, $name, $parameter);
     $response = $this->kernel->handle($request);
     $content = $response->getContent();
     $this->kernel->terminate($request, $response);
     $this->kernel->shutdown();
     if (null !== $name) {
         $filename = $this->router->generate($name, $parameter);
     } else {
         $filename = $route->getPath();
     }
     $this->writer->write($filename, $content);
 }
开发者ID:braincrafted,项目名称:static-site-bundle,代码行数:23,代码来源:RouteRenderer.php

示例6: handle

 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     if (false === $this->booted && $this->enableTenanting) {
         // Find and set the current tenant
         try {
             $tenant = $this->getCurrentTenantKey($request);
             $this->getTenantRegistry()->setCurrent($tenant);
             // Change the environment to the tenant's environment
             $this->environment = 'tenant_' . $tenant;
         } catch (\OutOfBoundsException $e) {
             throw new NotFoundHttpException('Could not find tenant');
         } catch (\RuntimeException $e) {
         }
         $this->boot();
     }
     return parent::handle($request, $type, $catch);
 }
开发者ID:kieljohn,项目名称:TenantBundle,代码行数:17,代码来源:TenantKernel.php

示例7: handle

 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     if (strpos($request->getRequestUri(), 'installer') !== false || !$this->isInstalled()) {
         define('MAUTIC_INSTALLER', 1);
     }
     if (false === $this->booted) {
         $this->boot();
     }
     //the context is not populated at this point so have to do it manually
     $router = $this->getContainer()->get('router');
     $requestContext = new \Symfony\Component\Routing\RequestContext();
     $requestContext->fromRequest($request);
     $router->setContext($requestContext);
     if (strpos($request->getRequestUri(), 'installer') === false && !$this->isInstalled()) {
         //the context is not populated at this point so have to do it manually
         $router = $this->getContainer()->get('router');
         $requestContext = new \Symfony\Component\Routing\RequestContext();
         $requestContext->fromRequest($request);
         $router->setContext($requestContext);
         $base = $requestContext->getBaseUrl();
         //check to see if the .htaccess file exists or if not running under apache
         if (strpos(strtolower($_SERVER["SERVER_SOFTWARE"]), 'apache') === false || !file_exists(__DIR__ . '../.htaccess') && strpos($base, 'index') === false) {
             $base .= '/index.php';
         }
         //return new RedirectResponse();
         return new RedirectResponse($base . '/installer');
     }
     // Check for an an active db connection and die with error if unable to connect
     if (!defined('MAUTIC_INSTALLER')) {
         $db = $this->getContainer()->get('database_connection');
         try {
             $db->connect();
         } catch (\Exception $e) {
             error_log($e);
             throw new \Mautic\CoreBundle\Exception\DatabaseConnectionException($this->getContainer()->get('translator')->trans('mautic.core.db.connection.error', array('%code%' => $e->getCode())));
         }
     }
     return parent::handle($request, $type, $catch);
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:42,代码来源:AppKernel.php

示例8: handleRaw

 private function handleRaw(Request $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     $this->container->enterScope('request');
     $this->container->set('request', $request, 'request');
     $this->container->get('request_stack')->push($request);
     if ($type === self::MASTER_REQUEST) {
         $this->request = $request;
     }
     Service::setRequest($request);
     $event = new GetResponseEvent($this, $request, $type);
     $this->container->get('event_dispatcher')->dispatch(KernelEvents::REQUEST, $event);
     if ($request->attributes->get('_defaultHandler')) {
         return parent::handle($request, $type, $catch);
     }
     // An event may have given a response
     if ($event->hasResponse()) {
         return $this->filterResponse($event->getResponse(), $request, $type);
     }
     $session = $this->container->get('session');
     $session->start();
     Service::setFormFactory($this->container->get('form.factory'));
     $con = Controller::getController($request->attributes);
     $response = $con->callAction();
     return $this->filterResponse($response, $request, $type);
 }
开发者ID:blast007,项目名称:bzion,代码行数:25,代码来源:AppKernel.php

示例9: theKernelTerminates

 /**
  * @When the kernel terminates
  */
 public function theKernelTerminates()
 {
     $request = Request::create('/', 'GET');
     $response = $this->kernel->handle($request);
     $this->kernel->terminate($request, $response);
 }
开发者ID:th3n3rd,项目名称:Tolerance,代码行数:9,代码来源:FeatureContext.php

示例10: updateJsLib

 /**
  * @return string
  */
 public function updateJsLib()
 {
     $response = $this->kernel->handle(Request::create('/js/fp_js_validator.js'));
     $libFile = $this->kernel->getRootDir() . '/../../Resources/public/js/fp_js_validator.js';
     file_put_contents($libFile, $response->getContent());
 }
开发者ID:eko,项目名称:JsFormValidatorBundle,代码行数:9,代码来源:TestTwigExtension.php

示例11: handle

 /**
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param int $type
  * @param bool $catch
  *
  * @return Symfony\Component\HttpFoundation\Response
  */
 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     $catch = false;
     return parent::handle($request, $type, $catch);
 }
开发者ID:DocHoncho,项目名称:PayumBundle,代码行数:12,代码来源:AppKernel.php


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