Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Core/Routing/NullMatcherDumper.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Core\Routing; |
Chris@0 | 4 |
Chris@0 | 5 use Symfony\Component\Routing\RouteCollection; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Does not dump Route information. |
Chris@0 | 9 */ |
Chris@0 | 10 class NullMatcherDumper implements MatcherDumperInterface { |
Chris@0 | 11 |
Chris@0 | 12 /** |
Chris@0 | 13 * The routes to be dumped. |
Chris@0 | 14 * |
Chris@0 | 15 * @var \Symfony\Component\Routing\RouteCollection |
Chris@0 | 16 */ |
Chris@0 | 17 protected $routes; |
Chris@0 | 18 |
Chris@0 | 19 /** |
Chris@0 | 20 * {@inheritdoc} |
Chris@0 | 21 */ |
Chris@0 | 22 public function addRoutes(RouteCollection $routes) { |
Chris@0 | 23 if (empty($this->routes)) { |
Chris@0 | 24 $this->routes = $routes; |
Chris@0 | 25 } |
Chris@0 | 26 else { |
Chris@0 | 27 $this->routes->addCollection($routes); |
Chris@0 | 28 } |
Chris@0 | 29 } |
Chris@0 | 30 |
Chris@0 | 31 /** |
Chris@0 | 32 * Dumps a set of routes to the router table in the database. |
Chris@0 | 33 * |
Chris@0 | 34 * Available options: |
Chris@0 | 35 * - provider: The route grouping that is being dumped. All existing |
Chris@0 | 36 * routes with this provider will be deleted on dump. |
Chris@0 | 37 * - base_class: The base class name. |
Chris@0 | 38 * |
Chris@0 | 39 * @param array $options |
Chris@0 | 40 * An array of options. |
Chris@0 | 41 */ |
Chris@0 | 42 public function dump(array $options = []) { |
Chris@0 | 43 // The dumper is reused for multiple providers, so reset the queued routes. |
Chris@0 | 44 $this->routes = NULL; |
Chris@0 | 45 } |
Chris@0 | 46 |
Chris@0 | 47 /** |
Chris@0 | 48 * Gets the routes to match. |
Chris@0 | 49 * |
Chris@0 | 50 * @return \Symfony\Component\Routing\RouteCollection |
Chris@0 | 51 * A RouteCollection instance representing all routes currently in the |
Chris@0 | 52 * dumper. |
Chris@0 | 53 */ |
Chris@0 | 54 public function getRoutes() { |
Chris@0 | 55 return $this->routes; |
Chris@0 | 56 } |
Chris@0 | 57 |
Chris@0 | 58 } |