RouterBase.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Routing/RouterBase.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Routing;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\EventDispatcher\EventDispatcher;
class RouterBase extends ArrayCollection implements RouterInterface {
protected $dispatcher;
public function __construct(array $elements = []) {
parent::__construct($elements);
$this->dispatcher = new EventDispatcher();
}
public function addRoute(RouteWrapperInterface $route) {
$this
->set($route
->getIdentifier(), $route);
$this->dispatcher
->addListener('router.built', [
$route,
'onRouterBuilt',
]);
}
public function finalize() {
$this->dispatcher
->dispatch('router.built', new RouterBuiltEvent($this));
}
}
Classes
Name |
Description |
RouterBase |
Base class for RouterInterface implementations. |