| Total Complexity | 5 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class PathHelper |
||
| 21 | { |
||
| 22 | protected string $path; |
||
| 23 | |||
| 24 | protected string $absolutePath; |
||
| 25 | |||
| 26 | public function __construct(string $path) |
||
| 29 | } |
||
| 30 | |||
| 31 | public function toAbsolutePath(string $workingDirectory): PathHelper |
||
| 32 | { |
||
| 33 | $real = realpath($workingDirectory . DIRECTORY_SEPARATOR . $this->path); |
||
| 34 | if ($real === false) { |
||
| 35 | throw new InvalidArgumentException( |
||
| 36 | sprintf('Cannot resolve absolute path to %s.', $this->path) |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | |||
| 40 | return new PathHelper($real); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getNormalizedPath(): string |
||
| 50 | } |
||
| 51 | } |
||
| 52 |