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