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