You are here

public function PathTranslatorEvent::__construct in Decoupled Router 8

Same name and namespace in other branches
  1. 2.x src/PathTranslatorEvent.php \Drupal\decoupled_router\PathTranslatorEvent::__construct()

PathTranslatorEvent constructor.

Parameters

\Symfony\Component\HttpKernel\HttpKernelInterface $kernel: The kernel.

\Symfony\Component\HttpFoundation\Request $request: The current request.

int $requestType: The type of request: master or subrequest.

string $path: The path to process.

File

src/PathTranslatorEvent.php, line 49

Class

PathTranslatorEvent
Path translation event.

Namespace

Drupal\decoupled_router

Code

public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, $path) {
  parent::__construct($kernel, $request, $requestType);
  $this->path = $path;

  // Assume a 404 from start.
  $this->response = CacheableJsonResponse::create([
    'message' => $this
      ->t('Unable to resolve path @path.', [
      '@path' => $path,
    ]),
    'details' => $this
      ->t('None of the available methods were able to find a match for this path.'),
  ], 404);
}