RoutesGroup.php 583 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace KarmaFW\Routing;
  3. class RoutesGroup
  4. {
  5. protected $routes = [];
  6. public function add($route)
  7. {
  8. $this->routes[] = $route;
  9. }
  10. public function setName($name)
  11. {
  12. foreach ($this->routes as $route) {
  13. $route->setName($name);
  14. }
  15. return $this;
  16. }
  17. public function setPrefix($prefix=null, $prefix_callback=null)
  18. {
  19. foreach ($this->routes as $route) {
  20. $route->setPrefix($prefix, $prefix_callback);
  21. }
  22. return $this;
  23. }
  24. public function notMatch($pattern)
  25. {
  26. foreach ($this->routes as $route) {
  27. $route->notMatch($pattern);
  28. }
  29. return $this;
  30. }
  31. }