You are here

public function StackedHttpKernel::terminate in Zircon Profile 8

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

Terminates a request/response cycle.

Should be called after sending the response and before shutting down the kernel.

Parameters

Request $request A Request instance:

Response $response A Response instance:

Overrides TerminableInterface::terminate

File

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

Class

StackedHttpKernel

Namespace

Stack

Code

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;
  }
}