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

CallForSupportBehaviour::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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