Example #1
0
 /**
  * {@inheritdoc}
  */
 public function createUri($route, $parameters = [], SlugifyInterface $slugify = null)
 {
     if (isset($this->routes[$route])) {
         return $this->routes[$route]->createUri($parameters, $this->basePath, $slugify);
     }
     //Will be handled via default route where route name is specified as controller::action
     if (strpos($route, RouteInterface::SEPARATOR) === false && strpos($route, '/') === false) {
         throw new RouterException("Unable to locate route or use default route with controller::action pattern.");
     }
     //We can fetch controller and action names from url
     list($controller, $action) = explode(RouteInterface::SEPARATOR, str_replace('/', RouteInterface::SEPARATOR, $route));
     return $this->defaultRoute->createUri(compact('controller', 'action') + $parameters, $this->basePath, $slugify);
 }