NullMatcherDumper.php 1.3 KB

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