Passed
Pull Request — master (#2101)
by Nico
11:01
created

AttackerProviderFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 35
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A createProjectilePhalanxAttacker() 0 6 1
A createEnergyPhalanxAttacker() 0 6 1
A createSpacecraftAttacker() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Spacecraft\Lib\Battle\Provider;
6
7
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Stu\Lib\Transfer\Storage\StorageManagerInterface;
9
use Stu\Module\Control\StuRandom;
10
use Stu\Module\Spacecraft\Lib\Torpedo\ShipTorpedoManagerInterface;
11
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
12
use Stu\Orm\Entity\ColonyInterface;
13
use Stu\Orm\Repository\ModuleRepositoryInterface;
14
15
class AttackerProviderFactory implements AttackerProviderFactoryInterface
16
{
17 4
    public function __construct(
18
        private ShipTorpedoManagerInterface $shipTorpedoManager,
19
        private ModuleRepositoryInterface $moduleRepository,
20
        private StorageManagerInterface $storageManager,
21
        private StuRandom $stuRandom
22 4
    ) {}
23
24 1
    #[Override]
25
    public function createSpacecraftAttacker(SpacecraftWrapperInterface $wrapper, bool $isAttackingShieldsOnly = false): SpacecraftAttacker
26
    {
27 1
        return new SpacecraftAttacker(
28 1
            $wrapper,
29 1
            $this->shipTorpedoManager,
30 1
            $isAttackingShieldsOnly,
31 1
            $this->stuRandom
32 1
        );
33
    }
34
35 1
    #[Override]
36
    public function createEnergyPhalanxAttacker(ColonyInterface $colony): EnergyAttackerInterface
37
    {
38 1
        return new EnergyPhalanx(
39 1
            $colony,
40 1
            $this->moduleRepository
41 1
        );
42
    }
43
44 1
    #[Override]
45
    public function createProjectilePhalanxAttacker(ColonyInterface $colony): ProjectileAttackerInterface
46
    {
47 1
        return new ProjectilePhalanx(
48 1
            $colony,
49 1
            $this->storageManager
50 1
        );
51
    }
52
}
53