You are here

class StackedHttpKernel in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/stack/builder/src/Stack/StackedHttpKernel.php \Stack\StackedHttpKernel

Hierarchy

Expanded class hierarchy of StackedHttpKernel

1 string reference to 'StackedHttpKernel'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses StackedHttpKernel
http_kernel in core/core.services.yml
Stack\StackedHttpKernel

File

vendor/stack/builder/src/Stack/StackedHttpKernel.php, line 10

Namespace

Stack
View source
class StackedHttpKernel implements HttpKernelInterface, TerminableInterface {
  private $app;
  private $middlewares = array();
  public function __construct(HttpKernelInterface $app, array $middlewares) {
    $this->app = $app;
    $this->middlewares = $middlewares;
  }
  public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) {
    return $this->app
      ->handle($request, $type, $catch);
  }
  public function terminate(Request $request, Response $response) {
    $prevKernel = null;
    foreach ($this->middlewares as $kernel) {

      // if prev kernel was terminable we can assume this middleware has already been called
      if (!$prevKernel instanceof TerminableInterface && $kernel instanceof TerminableInterface) {
        $kernel
          ->terminate($request, $response);
      }
      $prevKernel = $kernel;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HttpKernelInterface::MASTER_REQUEST constant
HttpKernelInterface::SUB_REQUEST constant
StackedHttpKernel::$app private property
StackedHttpKernel::$middlewares private property
StackedHttpKernel::handle public function Handles a Request to convert it to a Response. Overrides HttpKernelInterface::handle
StackedHttpKernel::terminate public function Terminates a request/response cycle. Overrides TerminableInterface::terminate
StackedHttpKernel::__construct public function