You are here

public function HttpKernel::handle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/HttpKernel.php \Symfony\Component\HttpKernel\HttpKernel::handle()

Handles a Request to convert it to a Response.

When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.

Parameters

Request $request A Request instance:

int $type The type of the request: (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)

bool $catch Whether to catch exceptions or not:

Return value

Response A Response instance

Throws

\Exception When an Exception occurs during processing

Overrides HttpKernelInterface::handle

3 calls to HttpKernel::handle()
ContainerAwareHttpKernel::handle in vendor/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php
Handles a Request to convert it to a Response.
TestHttpKernel::handle in vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php
Handles a Request to convert it to a Response.
TestMultipleHttpKernel::handle in vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php
Handles a Request to convert it to a Response.
3 methods override HttpKernel::handle()
ContainerAwareHttpKernel::handle in vendor/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php
Handles a Request to convert it to a Response.
TestHttpKernel::handle in vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php
Handles a Request to convert it to a Response.
TestMultipleHttpKernel::handle in vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php
Handles a Request to convert it to a Response.

File

vendor/symfony/http-kernel/HttpKernel.php, line 57

Class

HttpKernel
HttpKernel notifies events to convert a Request object to a Response one.

Namespace

Symfony\Component\HttpKernel

Code

public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) {
  $request->headers
    ->set('X-Php-Ob-Level', ob_get_level());
  try {
    return $this
      ->handleRaw($request, $type);
  } catch (\Exception $e) {
    if (false === $catch) {
      $this
        ->finishRequest($request, $type);
      throw $e;
    }
    return $this
      ->handleException($e, $request, $type);
  }
}