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

CallForSupportBehaviour   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 18
ccs 0
cts 8
cp 0
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A action() 0 8 1
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