Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function build(\ReRoute\Url $url, \ReRoute\UrlBuilder $urlBuilder)
 {
     $prefix = $this->getPrefix();
     if (!empty($prefix)) {
         $url->setPath($this->getPrefix() . $url->getPath());
     }
 }
 /**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $lang = $urlBuilder->useParameter('lang');
     if (!empty($lang)) {
         if ($lang != $this->defaultLanguage) {
             $url->setPath('/' . $lang . $url->getPath());
         }
     }
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $url->setHost('admin.example.com');
     $parts = [];
     $action = $urlBuilder->useParameter('action');
     if (!empty($action) and $action != $this->defaultAction) {
         $parts[] = $action;
     }
     $controllerItem = $urlBuilder->useParameter('controllerItem');
     if (!empty($parts) or !empty($controllerItem) and $action != $this->defaultControllerItem) {
         $parts[] = $controllerItem;
     }
     $controllerGroup = $urlBuilder->useParameter('controllerGroup');
     if (!empty($parts) or !empty($controllerGroup) and $action != $this->defaultControllerGroup) {
         $parts[] = $controllerGroup;
     }
     $url->setPath('/' . implode('/', array_reverse($parts)));
     parent::build($url, $urlBuilder);
 }
Exemplo n.º 4
0
 /**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $url->setPath('my' . $url->getPath());
 }
Exemplo n.º 5
0
 /**
  * @param Url $url
  * @param UrlBuilder $urlBuilder
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     if (!empty($this->hostTemplate)) {
         $url->setHost($this->templateBuild($this->hostTemplate, $urlBuilder));
     }
     if (!empty($this->pathTemplate)) {
         $url->setPath($this->templateBuild($this->pathTemplate, $urlBuilder));
     }
     if (!empty($this->scheme)) {
         $url->setScheme($this->scheme);
     }
 }