Conditions | 8 |
Paths | 29 |
Total Lines | 30 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 8 | public static function exec(FilesystemInterface $vfs, string ...$ids): bool |
|
19 | { |
||
20 | 8 | $exist = true; |
|
21 | 8 | $existId = true; |
|
22 | |||
23 | 8 | foreach ($ids as $id) { |
|
24 | 8 | $path = Path::fromString($id); |
|
25 | |||
26 | /** @var \drupol\phpvfs\Node\DirectoryInterface $cwd */ |
||
27 | 8 | $cwd = $path->isAbsolute() ? |
|
28 | 8 | $vfs->getCwd()->root() : |
|
29 | 8 | $vfs->getCwd(); |
|
30 | |||
31 | 8 | foreach ($path->getIterator() as $pathPart) { |
|
32 | 8 | $pathPartExist = false; |
|
33 | |||
34 | 8 | if (\DIRECTORY_SEPARATOR === $pathPart) { |
|
35 | 2 | $pathPartExist = true; |
|
36 | 8 | } elseif (null !== $child = $cwd->containsAttributeId($pathPart)) { |
|
37 | 8 | $pathPartExist = true; |
|
38 | 8 | $cwd = $child; |
|
39 | } |
||
40 | |||
41 | 8 | $existId = $existId && $pathPartExist; |
|
|
|||
42 | } |
||
43 | |||
44 | 8 | $exist = $exist && $existId; |
|
45 | } |
||
46 | |||
47 | 8 | return $exist; |
|
48 | } |
||
50 |