| 1 | <?php |
||
| 22 | final class Path |
||
| 23 | { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var \Eloquent\Pathogen\PathInterface |
||
| 27 | */ |
||
| 28 | private $rootPath; |
||
| 29 | |||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $path |
||
| 33 | */ |
||
| 34 | public function __construct($path) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param string $path |
||
| 41 | */ |
||
| 42 | public function join($path) |
||
| 43 | { |
||
| 44 | $relativePath = RelativePath::fromString($path); |
||
| 45 | |||
| 46 | $resultPath = $this->rootPath->join($relativePath); |
||
| 47 | $newRootPath = $resultPath->normalize()->string(); |
||
| 48 | |||
| 49 | return Path::fromString($newRootPath); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function stringify() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | public function __toString() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @param string $path |
||
| 70 | * @return Path |
||
| 71 | */ |
||
| 72 | public static function fromString($path) |
||
| 76 | |||
| 77 | } |
||
| 78 |