Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function getItems(WritableRepositoryInterface $repository) |
||
30 | { |
||
31 | $packages = $repository->getPackages(); |
||
32 | |||
33 | if (empty($this->vendors)) { |
||
34 | return $packages; |
||
|
|||
35 | } |
||
36 | |||
37 | $allowedVendors = array_fill_keys($this->vendors, true); |
||
38 | return array_filter( |
||
39 | $packages, |
||
40 | function (PackageInterface $package) use ($allowedVendors) { |
||
41 | $vendorName = strtok($package->getName(), ComposerConstants::PACKAGE_SEPARATOR); |
||
42 | |||
43 | return isset($allowedVendors[$vendorName]); |
||
44 | } |
||
48 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: