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

FgetsUserInputRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInput() 0 8 2
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