You are here

public function UrlRegistrar::handle in URLs queuer 8

File

src/StackMiddleware/UrlRegistrar.php, line 166

Class

UrlRegistrar
Collects URLs for all passing traffic.

Namespace

Drupal\purge_queuer_url\StackMiddleware

Code

public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {

  /** @var \Symfony\Component\HttpFoundation\Response|\Drupal\Core\Cache\CacheableResponseInterface$response */
  $response = $this->httpKernel
    ->handle($request, $type, $catch);
  $what_to_do = $this
    ->determine($request, $response);
  if ($what_to_do === TRUE) {
    $this->registry
      ->add($this
      ->generateUrlOrPathToRegister($request), $response
      ->getCacheableMetadata()
      ->getCacheTags());
  }
  elseif (is_null($what_to_do)) {
    $this->registry
      ->remove($this
      ->generateUrlOrPathToRegister($request));
  }
  return $response;
}