/** * {@inheritdoc} */ public function normalize() { return $this->withProperty('path', $this->path->withoutDotSegments()); }
/** * {@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))); }