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

TravelEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A __invoke() 0 7 1
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