diff --git a/src/Library/File/Path.php b/src/Library/File/Path.php index 7739b34..96f5057 100755 --- a/src/Library/File/Path.php +++ b/src/Library/File/Path.php @@ -34,13 +34,34 @@ public function equals(Path $path) return $this->asString() === $path->asString(); } + /** + * @param Path $path + * + * @return bool + */ public function contains(Path $path) { return (strstr($this->asString(), $path->asString()) !== false); } + /** + * @param Path $path + * + * @return bool + */ public function startsWith(Path $path) { return (substr($this->asString(), 0, strlen($path->asString())) === $path->asString()); } + + /** + * @param int $index + * + * @return string + */ + public function segment($index) + { + $segments = explode('/', trim($this->path, '/')); + return $segments[$index]; + } }