add() public method

Adds a Route to the end of current collection.
public add ( string $name, Route $route )
$name string Route name.
$route Route Instance of Route.
コード例 #1
0
ファイル: ConfigLoader.php プロジェクト: Webiny/Framework
 /**
  * Builds and returns RouteCollection instance.
  *
  * @return RouteCollection
  */
 public function getRouteCollection()
 {
     foreach ($this->config as $name => $routeConfig) {
         $this->routeCollection->add($name, $this->processRoute($routeConfig));
     }
     unset($this->config);
     return $this->routeCollection;
 }
コード例 #2
0
ファイル: Router.php プロジェクト: Webiny/Framework
 /**
  * Adds a route to the end of the current route collection.
  *
  * @param ConfigObject $routes An instance of ConfigObject holding the routes.
  *
  * @return $this
  */
 public function appendRoutes(ConfigObject $routes)
 {
     foreach ($routes as $name => $routeConfig) {
         self::$routeCollection->add($name, $this->loader->processRoute($routeConfig));
     }
     return $this;
 }