Passed
Pull Request — master (#1779)
by Nico
49:51 queued 23:55
created

CallForSupportBehaviour::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
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
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Stu\Lib\Pirate\Behaviour;
4
5
use Stu\Module\Ship\Lib\FleetWrapperInterface;
6
use Stu\Lib\Pirate\PirateCreationInterface;
7
use Stu\Lib\Pirate\PirateReactionInterface;
8
use Stu\Lib\Pirate\PirateReactionTriggerEnum;
9
10
class CallForSupportBehaviour implements PirateBehaviourInterface
11
{
12
    private PirateCreationInterface $pirateCreation;
13
14
    public function __construct(
15
        PirateCreationInterface $pirateCreation
16
    ) {
17
        $this->pirateCreation = $pirateCreation;
18
    }
19
20
    public function action(FleetWrapperInterface $fleet, PirateReactionInterface $pirateReaction): void
21
    {
22
        $leadWrapper = $fleet->getLeadWrapper();
23
        $leadShip = $leadWrapper->get();
24
25
        $pirateReaction->react(
26
            $this->pirateCreation->createPirateFleet($leadShip),
27
            PirateReactionTriggerEnum::ON_SUPPORT_CALL
28
        );
29
    }
30
}
31