コード例 #1
0
 /**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $domain = $urlBuilder->useParameter('_domain');
     $url->setHost($domain);
     $isMobile = $urlBuilder->useParameter('_isMobile');
     if ($isMobile === true) {
         $url->setHost('m.' . $url->getHost());
     }
     if ($devBranch = $urlBuilder->useParameter('_devBranch')) {
         $url->setHost($devBranch . '.debug.' . $url->getHost());
     }
     parent::build($url, $urlBuilder);
 }
コード例 #2
0
ファイル: AdminRoute.php プロジェクト: shakhraj/reroute
 /**
  * @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);
 }
コード例 #3
0
ファイル: UrlTemplate.php プロジェクト: shakhraj/reroute
 /**
  * @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);
     }
 }