Ejemplo n.º 1
0
 /**
  * @param Uri $uri
  * @return int
  */
 protected function checkUrl(Uri $uri)
 {
     if ($uri->getHost()) {
         $status = 1;
     } elseif ($uri->getScheme() != '' && $uri->getScheme() != 'file') {
         $status = 2;
     } elseif (!$uri->getPath()) {
         $status = 3;
     } else {
         $status = 0;
     }
     return $status;
 }
Ejemplo n.º 2
0
 /**
  * @param self $base
  */
 protected function completePath(self $base)
 {
     $basePath = $base->getPath();
     $relPath = $this->getPath();
     //
     if (!$relPath) {
         $this->setPath($basePath);
         if (!$this->getQuery()) {
             $this->setQuery($base->getQuery());
         }
     } else {
         if (substr($relPath, 0, 1) == '/') {
             $this->setPath(static::shortPath($relPath));
         } else {
             if ($base->getHost() && !$basePath) {
                 $mergedPath = "/";
             } else {
                 $cut = strrpos($basePath, '/');
                 $mergedPath = $cut !== false ? substr($basePath, 0, $cut + 1) : '';
             }
             $this->setPath(static::shortPath($mergedPath . $relPath));
         }
     }
 }