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