Passed
Push — master ( e661f4...30021e )
by Nico
25:16 queued 10:59
created

createSpacecraftAttacker()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 2
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
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