예제 #1
0
 /**
  *
  * Gets a Route for generation.
  *
  * @param string $name Get this route name.
  *
  * @return Route
  *
  * @throws Exception\RouteNotFound when the named route does not exist.
  *
  */
 protected function getRouteForGenerate($name)
 {
     if (!$this->routes->offsetExists($name)) {
         throw new Exception\RouteNotFound($name);
     }
     return $this->routes->offsetGet($name);
 }
예제 #2
0
파일: Router.php 프로젝트: Umz/ImpressPages
 /**
  * 
  * Looks up a route by name, and interpolates data into it to return
  * a URI path.
  * 
  * @param string $name The route name to look up.
  * 
  * @param array $data The data to interpolate into the URI; data keys
  * map to param tokens in the path.
  * 
  * @return string|false A URI path string if the route name is found, or
  * boolean false if not.
  * 
  */
 public function generate($name, $data = null)
 {
     if (!$this->routes->offsetExists($name)) {
         throw new Exception\RouteNotFound($name);
     }
     return $this->routes->offsetGet($name)->generate($data);
 }