예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function normalize()
 {
     return $this->withProperty('path', $this->path->withoutDotSegments());
 }
예제 #2
0
파일: Path.php 프로젝트: BauRo/url
 /**
  * {@inheritdoc}
  */
 public function relativize(Interfaces\Path $path)
 {
     $bSegments = explode(static::$delimiter, $this->withoutDotSegments()->__toString());
     $cSegments = explode(static::$delimiter, $path->withoutDotSegments()->__toString());
     if ('' == end($bSegments)) {
         array_pop($bSegments);
     }
     $key = 0;
     $res = [];
     while (isset($cSegments[$key], $bSegments[$key]) && $cSegments[$key] === $bSegments[$key]) {
         ++$key;
         $res[] = '..';
     }
     return static::createFromArray(array_merge($res, array_slice($cSegments, $key)));
 }