|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stu\Module\Colony\Lib\Gui\Component; |
|
4
|
|
|
|
|
5
|
|
|
use Override; |
|
|
|
|
|
|
6
|
|
|
use Stu\Module\Colony\Lib\ColonyLibFactoryInterface; |
|
7
|
|
|
use Stu\Module\Commodity\CommodityTypeEnum; |
|
|
|
|
|
|
8
|
|
|
use Stu\Module\Commodity\Lib\CommodityCacheInterface; |
|
9
|
|
|
use Stu\Module\Control\GameControllerInterface; |
|
10
|
|
|
use Stu\Orm\Entity\ColonyInterface; |
|
11
|
|
|
use Stu\Orm\Repository\ColonyDepositMiningRepositoryInterface; |
|
12
|
|
|
|
|
13
|
|
|
final class EffectsProvider implements PlanetFieldHostComponentInterface |
|
14
|
|
|
{ |
|
15
|
1 |
|
public function __construct( |
|
16
|
|
|
private readonly ColonyDepositMiningRepositoryInterface $colonyDepositMiningRepository, |
|
17
|
|
|
private readonly ColonyLibFactoryInterface $colonyLibFactory, |
|
18
|
|
|
private readonly CommodityCacheInterface $commodityCache |
|
19
|
1 |
|
) {} |
|
20
|
|
|
|
|
21
|
4 |
|
#[Override] |
|
22
|
|
|
public function setTemplateVariables( |
|
23
|
|
|
$entity, |
|
24
|
|
|
GameControllerInterface $game |
|
25
|
|
|
): void { |
|
26
|
4 |
|
$commodities = $this->commodityCache->getAll(CommodityTypeEnum::COMMODITY_TYPE_EFFECT); |
|
27
|
|
|
|
|
28
|
4 |
|
$depositMinings = $entity instanceof ColonyInterface ? $this->colonyDepositMiningRepository->getCurrentUserDepositMinings($entity) : []; |
|
29
|
4 |
|
$prod = $this->colonyLibFactory->createColonyCommodityProduction($entity)->getProduction(); |
|
30
|
|
|
|
|
31
|
4 |
|
$effects = []; |
|
32
|
4 |
|
foreach ($commodities as $value) { |
|
33
|
4 |
|
$commodityId = $value->getId(); |
|
34
|
|
|
|
|
35
|
|
|
//skip deposit effects on asteroid |
|
36
|
4 |
|
if (array_key_exists($commodityId, $depositMinings)) { |
|
37
|
|
|
continue; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
4 |
|
if (!array_key_exists($commodityId, $prod) || $prod[$commodityId]->getProduction() == 0) { |
|
41
|
4 |
|
continue; |
|
42
|
|
|
} |
|
43
|
4 |
|
$effects[$commodityId]['commodity'] = $value; |
|
44
|
4 |
|
$effects[$commodityId]['production'] = $prod[$commodityId]; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
4 |
|
$game->setTemplateVar('EFFECTS', $effects); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
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