| Conditions | 5 |
| Paths | 10 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 5.0144 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 7 | public static function exec(FilesystemInterface $vfs, string $id): VfsInterface |
|
| 22 | { |
||
| 23 | 7 | $path = Path::fromString($id); |
|
| 24 | |||
| 25 | /** @var \drupol\phpvfs\Node\DirectoryInterface $cwd */ |
||
| 26 | 7 | $cwd = $path->isAbsolute() ? |
|
| 27 | 6 | $vfs->getCwd()->root() : |
|
| 28 | 7 | $vfs->getCwd(); |
|
| 29 | |||
| 30 | 7 | foreach ($path->getIterator() as $pathPart) { |
|
| 31 | 7 | if (null !== $child = $cwd->containsAttributeId($pathPart)) { |
|
| 32 | 7 | $cwd = $child; |
|
| 33 | } else { |
||
| 34 | 1 | throw new \Exception('Unknown path.'); |
|
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | 7 | if (null === $cwd) { |
|
|
|
|||
| 39 | throw new \Exception('TODO'); |
||
| 40 | } |
||
| 41 | |||
| 42 | 7 | return $cwd; |
|
| 43 | } |
||
| 45 |