Passed
Push — master ( db43e8...42566f )
by Paweł
02:54
created

PlayerInput::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Infrastructure\Cli;
6
7
use AardsGerds\Game\Event\Decision;
8
use AardsGerds\Game\Event\DecisionCollection;
9
use AardsGerds\Game\Player\PlayerAction;
10
use Symfony\Component\Console\Style\SymfonyStyle;
11
12
final class PlayerInput implements PlayerAction
13
{
14
    public function __construct(
15
        private SymfonyStyle $io,
16
    ) {}
17
18
    public function askForDecision(string $question, DecisionCollection $decisions): Decision
19
    {
20
        return $this->io->choice($question, $decisions->getItems());
21
    }
22
23
    public function askForInformation(string $question): int|string
24
    {
25
        return $this->io->ask($question);
26
    }
27
28
    public function askForConfirmation(string $question): bool
29
    {
30
        return $this->io->confirm($question);
31
    }
32
}
33