You are here

public function PsrResponseSubscriber::onKernelView in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/EventSubscriber/PsrResponseSubscriber.php \Drupal\Core\EventSubscriber\PsrResponseSubscriber::onKernelView()

Converts a PSR-7 response to a Symfony response.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event: The Event to process.

File

core/lib/Drupal/Core/EventSubscriber/PsrResponseSubscriber.php, line 45
Contains \Drupal\Core\EventSubscriber\PsrResponseSubscriber.

Class

PsrResponseSubscriber
Response subscriber for handling PSR-7 responses.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelView(GetResponseForControllerResultEvent $event) {
  $controller_result = $event
    ->getControllerResult();
  if ($controller_result instanceof ResponseInterface) {
    $event
      ->setResponse($this->httpFoundationFactory
      ->createResponse($controller_result));
  }
}