Passed
Push — master ( 888025...8927c7 )
by Paweł
03:33
created

DialogEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 9
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Event;
6
7
use AardsGerds\Game\Dialog\DialogOption;
8
use AardsGerds\Game\Entity\Entity;
9
use AardsGerds\Game\Player\Player;
10
use AardsGerds\Game\Player\PlayerAction;
11
12
abstract class DialogEvent extends Event
13
{
14 1
    public function __construct(
15
        Context $context,
16
        DecisionCollection $decisionCollection,
17
        protected Entity $subject,
18
        protected DialogOption $dialogOption,
19
    ) {
20 1
        parent::__construct(
21 1
            $context,
22
            $decisionCollection,
23
        );
24 1
    }
25
26
    public function __invoke(Player $player, PlayerAction $playerAction): Decision
27
    {
28
        return $playerAction->askForDecision((string) $this->context, $this->decisionCollection);
29
    }
30
31
    public function getSubject(): Entity
32
    {
33
        return $this->subject;
34
    }
35
}
36