Completed
Pull Request — master (#2)
by thomas
01:50
created

FgetsUserInputRequest::getInput()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\Trezor\Device\UserInput;
6
7
use BitWasp\Trezor\Device\Exception\UserInputException;
8
9
class FgetsUserInputRequest extends UserInputRequest
10
{
11
    public function getInput(): string
12
    {
13
        $input = fgets(STDIN);
14
        if (is_string($input)) {
0 ignored issues
show
introduced by
The condition is_string($input) is always true.
Loading history...
15
            return $input;
16
        }
17
18
        throw new UserInputException("Failed to read from command line");
19
    }
20
}
21