Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | 2 | public function exportToArray(): array |
|
12 | { |
||
13 | 2 | $data = $this->getEvent()->getComposer()->getLocker()->getLockData(); |
|
14 | |||
15 | 2 | $packagesData = array_merge( |
|
16 | 2 | $data['packages'], |
|
17 | 2 | $data['packages-dev'] |
|
18 | ); |
||
19 | |||
20 | 2 | $directories = []; |
|
21 | |||
22 | 2 | foreach ($packagesData as $package) { |
|
23 | 2 | $package = (new ArrayLoader())->load($package); |
|
24 | |||
25 | 2 | $directories[$package->getName()] = $this |
|
26 | 2 | ->getEvent() |
|
27 | 2 | ->getComposer() |
|
28 | 2 | ->getInstallationManager() |
|
29 | 2 | ->getInstallPath($package); |
|
30 | } |
||
31 | |||
32 | 2 | return [ |
|
|
|||
33 | 'directories' => $directories, |
||
34 | 2 | 'regex' => $this->buildRegex($directories), |
|
35 | ]; |
||
59 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: