dac9198e417482cafe3bcc6b050e2b2d03e56281
[yaffs-website] / web / modules / contrib / devel / webprofiler / src / StackMiddleware / WebprofilerMiddleware.php
1 <?php
2
3 namespace Drupal\webprofiler\StackMiddleware;
4
5 use Drupal\Core\Database\Database;
6 use Symfony\Component\HttpFoundation\Request;
7 use Symfony\Component\HttpKernel\HttpKernelInterface;
8
9 /**
10  * Class WebprofilerMiddleware
11  */
12 class WebprofilerMiddleware implements HttpKernelInterface {
13
14   /**
15    * The decorated kernel.
16    *
17    * @var \Symfony\Component\HttpKernel\HttpKernelInterface
18    */
19   protected $httpKernel;
20
21   /**
22    * Constructs a WebprofilerMiddleware object.
23    *
24    * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
25    *   The decorated kernel.
26    */
27   public function __construct(HttpKernelInterface $http_kernel) {
28     $this->httpKernel = $http_kernel;
29   }
30
31   /**
32    * {@inheritdoc}
33    */
34   public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
35     foreach (Database::getAllConnectionInfo() as $key => $info) {
36       Database::startLog('webprofiler', $key);
37     }
38     return $this->httpKernel->handle($request, $type, $catch);
39   }
40
41 }