Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
9 | public function __invoke(string $composerJsonPath) : Generator |
||
10 | { |
||
11 | $packageDir = dirname($composerJsonPath); |
||
12 | |||
13 | $vendorDirs = array_values(array_map( |
||
14 | function (string $vendorName) use ($packageDir) { |
||
15 | return $packageDir . '/vendor/' . $vendorName; |
||
16 | }, |
||
17 | array_keys(json_decode(file_get_contents($composerJsonPath), true)['require'] ?? []) |
||
18 | )); |
||
19 | |||
20 | foreach ($vendorDirs as $vendorDir) { |
||
21 | if (! file_exists($vendorDir . '/composer.json')) { |
||
22 | continue; |
||
23 | } |
||
24 | |||
25 | yield from (new LocateComposerPackageSourceFiles())->__invoke($vendorDir . '/composer.json'); |
||
26 | } |
||
27 | } |
||
28 | } |
||
29 |