Passed
Push — master ( cdfe84...9137c7 )
by Paweł
21:48
created

FightWolfDecision   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
c 0
b 0
f 0
dl 0
loc 17
ccs 0
cts 7
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 5 1
A __toString() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Event\Story\FirstChapter\WolfEncounter;
6
7
use AardsGerds\Game\Entity\Beast\Animal\Wolf;
8
use AardsGerds\Game\Event\Decision;
9
use AardsGerds\Game\Event\Story\FirstChapter\FightWolf\FightWolfEvent;
10
use AardsGerds\Game\Player\Player;
11
use AardsGerds\Game\Event\Event;
12
13
final class FightWolfDecision extends Decision
14
{
15
    public function __construct(
16
        Player $player,
17
        private Wolf $wolf,
18
    ) {
19
        parent::__construct($player);
20
    }
21
22
    public function __invoke(): Event
23
    {
24
        return new FightWolfEvent($this->player, $this->wolf);
25
    }
26
27
    public function __toString(): string
28
    {
29
        return "Attack wolf";
30
    }
31
}
32