| Conditions | 7 |
| Paths | 6 |
| Total Lines | 29 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function collect(): array |
||
| 21 | { |
||
| 22 | $file = File::getInstance(); |
||
| 23 | |||
| 24 | $symfonyDomains = []; |
||
| 25 | |||
| 26 | $documentRoots = WebserverUtil::extractDocumentRoots($this->inventory); |
||
| 27 | |||
| 28 | foreach ($documentRoots as $domain => $documentRoot) { |
||
| 29 | if ($file->fileExists($documentRoot . '/../composer.lock')) { |
||
| 30 | $composerLockRaw = File::getInstance()->getContents($documentRoot . '/../composer.lock'); |
||
| 31 | $composerLock = json_decode($composerLockRaw, true); |
||
| 32 | |||
| 33 | if (array_key_exists('packages', $composerLock) && is_array($composerLock['packages'])) { |
||
| 34 | foreach ($composerLock['packages'] as $package) { |
||
| 35 | if ($package['name'] === 'symfony/framework-bundle') { |
||
| 36 | $symfonyDomains[$domain] = [ |
||
| 37 | 'version' => trim($package['version'], 'v'), |
||
| 38 | 'path' => $file->realPath($documentRoot . '/../') |
||
| 39 | ]; |
||
| 40 | break; |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | return [ |
||
| 48 | 'framework' => $symfonyDomains |
||
| 49 | ]; |
||
| 52 |