Passed
Push — dev ( d6f4d5...f7beaa )
by Janko
21:35
created

CallForSupportBehaviour   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 33
ccs 0
cts 6
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A action() 0 20 1
1
<?php
2
3
namespace Stu\Lib\Pirate\Behaviour;
4
5
use Stu\Lib\Pirate\PirateBehaviourEnum;
6
use Stu\Module\Ship\Lib\FleetWrapperInterface;
7
use Stu\Lib\Pirate\PirateReactionInterface;
8
use Stu\Lib\Pirate\PirateReactionTriggerEnum;
9
use Stu\Module\Logging\LoggerUtilFactoryInterface;
10
use Stu\Module\Logging\PirateLoggerInterface;
11
12
class CallForSupportBehaviour implements PirateBehaviourInterface
13
{
14
    //private PirateCreationInterface $pirateCreation;
15
16
    private PirateLoggerInterface $logger;
17
18
    public function __construct(
19
        //PirateCreationInterface $pirateCreation,
20
        LoggerUtilFactoryInterface $loggerUtilFactory
21
    ) {
22
        $this->logger = $loggerUtilFactory->getPirateLogger();
23
    }
24
25
    public function action(FleetWrapperInterface $fleet, PirateReactionInterface $pirateReaction): ?PirateBehaviourEnum
26
    {
27
        $leadWrapper = $fleet->getLeadWrapper();
28
        $leadShip = $leadWrapper->get();
0 ignored issues
show
Unused Code introduced by
The assignment to $leadShip is dead and can be removed.
Loading history...
29
30
        /** 
31
         $supportFleet = $this->pirateCreation->createPirateFleet($leadShip);
32
        $this->logger->logf(
33
            '    created support fleet %d "%s" here %s',
34
            $supportFleet->getId(),
35
            $supportFleet->getName(),
36
            $supportFleet->getLeadShip()->getSectorString()
37
        );
38
39
        $pirateReaction->react(
40
            $supportFleet,
41
            PirateReactionTriggerEnum::ON_SUPPORT_CALL
42
        );*/
43
44
        return null;
45
    }
46
}
47