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