Пример #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)));
 }