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

TravelEvent::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
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 7
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\Player\Player;
8
use AardsGerds\Game\Shared\IntegerValue;
9
10
abstract class TravelEvent extends Event
11
{
12
    public function __construct(
13
        Context $context,
14
        DecisionCollection $decisionCollection,
15
        Player $player,
16
    ) {
17
        parent::__construct(
18
            EventType::travel(),
19
            $context,
20
            $decisionCollection,
21
            $player,
22
        );
23
    }
24
25
    public function __invoke(): Decision
26
    {
27
        // travel, encounter or explore?
28
        $decision = $this->decisionCollection->findByOrder(new IntegerValue(1));
29
        assert($decision !== null);
30
31
        return $decision;
32
    }
33
}
34