Passed
Push — master ( a55f22...56813c )
by Paweł
02:35
created

FightEvent::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Event;
6
7
use AardsGerds\Game\Entity\EntityCollection;
8
use AardsGerds\Game\Player\Player;
9
use AardsGerds\Game\Shared\IntegerValue;
10
11
abstract class FightEvent extends Event
12
{
13
    public function __construct(
14
        Context $context,
15
        DecisionCollection $decisionCollection,
16
        Player $player,
17
        protected EntityCollection $subjects,
18
    ) {
19
        parent::__construct(
20
            EventType::fight(),
21
            $context,
22
            $decisionCollection,
23
            $player,
24
        );
25
    }
26
27
    public function __invoke(): Decision
28
    {
29
        // fight!
30
        // travel, loot or dialog?
31
        $decision = $this->decisionCollection->findByOrder(new IntegerValue(1));
32
        assert($decision !== null);
33
34
        return $decision;
35
    }
36
}
37