Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

ContainerAwareHttpKernel.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.39 KiB


01  <?php
02   
03  /*
04   * This file is part of the Symfony package.
05   *
06   * (c) Fabien Potencier <fabien@symfony.com>
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Symfony\Component\HttpKernel\DependencyInjection;
13   
14  use Symfony\Component\HttpFoundation\Request;
15  use Symfony\Component\HttpKernel\HttpKernelInterface;
16  use Symfony\Component\HttpKernel\HttpKernel;
17  use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
18  use Symfony\Component\EventDispatcher\EventDispatcherInterface;
19  use Symfony\Component\DependencyInjection\ContainerInterface;
20  use Symfony\Component\DependencyInjection\Scope;
21   
22  /**
23   * Adds a managed request scope.
24   *
25   * @author Fabien Potencier <fabien@symfony.com>
26   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
27   */
28  class ContainerAwareHttpKernel extends HttpKernel
29  {
30      protected $container;
31   
32      /**
33       * Constructor.
34       *
35       * @param EventDispatcherInterface    $dispatcher         An EventDispatcherInterface instance
36       * @param ContainerInterface          $container          A ContainerInterface instance
37       * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance
38       */
39      public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
40      {
41          parent::__construct($dispatcher, $controllerResolver);
42   
43          $this->container = $container;
44   
45          // the request scope might have been created before (see FrameworkBundle)
46          if (!$container->hasScope('request')) {
47              $container->addScope(new Scope('request'));
48          }
49      }
50   
51      /**
52       * {@inheritdoc}
53       */
54      public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
55      {
56          $request->headers->set('X-Php-Ob-Level', ob_get_level());
57   
58          $this->container->enterScope('request');
59          $this->container->set('request', $request, 'request');
60   
61          try {
62              $response = parent::handle($request, $type, $catch);
63          } catch (\Exception $e) {
64              $this->container->set('request', null, 'request');
65              $this->container->leaveScope('request');
66   
67              throw $e;
68          }
69   
70          $this->container->set('request', null, 'request');
71          $this->container->leaveScope('request');
72   
73          return $response;
74      }
75  }
76