Conditions | 5 |
Paths | 5 |
Total Lines | 29 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 8.125 |
Changes | 0 |
1 | <?php |
||
17 | 1 | #[Override] |
|
18 | public function getConsumption( |
||
19 | array $production, |
||
20 | ColonyInterface $colony |
||
21 | ): array { |
||
22 | 1 | $depositMinings = $this->colonyDepositMiningRepository->getCurrentUserDepositMinings($colony); |
|
23 | 1 | $storages = $colony->getStorage(); |
|
24 | 1 | $ret = []; |
|
25 | 1 | foreach ($production as $commodityId => $productionItem) { |
|
26 | 1 | $proc = $productionItem->getProduction(); |
|
27 | 1 | if ($proc >= 0) { |
|
28 | 1 | continue; |
|
29 | } |
||
30 | |||
31 | $commodity = $productionItem->getCommodity(); |
||
32 | $ret[$commodityId]['commodity'] = $commodity; |
||
33 | $ret[$commodityId]['production'] = $productionItem->getProduction(); |
||
34 | |||
35 | if (array_key_exists($commodityId, $depositMinings)) { |
||
36 | $deposit = $depositMinings[$commodityId]; |
||
37 | $ret[$commodityId]['turnsleft'] = (int) floor($deposit->getAmountLeft() / abs($proc)); |
||
38 | } else { |
||
39 | $storage = $storages->get($commodityId); |
||
40 | $stored = $storage !== null ? $storage->getAmount() : 0; |
||
41 | $ret[$commodityId]['turnsleft'] = (int) floor($stored / abs($proc)); |
||
42 | } |
||
43 | } |
||
44 | |||
45 | 1 | return $ret; |
|
46 | } |
||
48 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths