RouteProvider.php in Drupal 10
File
core/tests/Drupal/KernelTests/RouteProvider.php
View source
<?php
namespace Drupal\KernelTests;
use Drupal\Core\Routing\PreloadableRouteProviderInterface;
use Symfony\Component\HttpFoundation\Request;
class RouteProvider implements PreloadableRouteProviderInterface {
use \Drupal\Core\DependencyInjection\DependencySerializationTrait;
protected function lazyLoadItself() {
if (!isset($this->service)) {
$container = \Drupal::getContainer();
$this->service = $container
->get('test.router.route_provider');
$container
->get('router.builder')
->rebuild();
}
return $this->service;
}
public function getRouteCollectionForRequest(Request $request) {
return $this
->lazyLoadItself()
->getRouteCollectionForRequest($request);
}
public function getRouteByName($name) {
return $this
->lazyLoadItself()
->getRouteByName($name);
}
public function preLoadRoutes($names) {
return $this
->lazyLoadItself()
->preLoadRoutes($names);
}
public function getRoutesByNames($names) {
return $this
->lazyLoadItself()
->getRoutesByNames($names);
}
public function getCandidateOutlines(array $parts) {
return $this
->lazyLoadItself()
->getCandidateOutlines($parts);
}
public function getRoutesByPattern($pattern) {
return $this
->lazyLoadItself()
->getRoutesByPattern($pattern);
}
public function routeProviderRouteCompare(array $a, array $b) {
return $this
->lazyLoadItself()
->routeProviderRouteCompare($a, $b);
}
public function getAllRoutes() {
return $this
->lazyLoadItself()
->getAllRoutes();
}
public function reset() {
return $this
->lazyLoadItself()
->reset();
}
}
Classes
Name |
Description |
RouteProvider |
Rebuilds the router when the provider is instantiated. |