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