1 | <?php |
||
8 | class Stdin implements ReaderInterface |
||
9 | { |
||
10 | protected $stdIn = false; |
||
11 | |||
12 | private $interactive = true; |
||
13 | |||
14 | /** |
||
15 | * Read the line typed in by the user |
||
16 | * |
||
17 | * @return string |
||
18 | */ |
||
19 | public function line() |
||
26 | |||
27 | /** |
||
28 | * Read from STDIN until EOF (^D) is reached |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | public function multiLine() |
||
39 | |||
40 | /** |
||
41 | * @inheritdoc |
||
42 | */ |
||
43 | public function isIteractive(): bool |
||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | public function setInteractive(bool $interactive): void |
||
55 | |||
56 | /** |
||
57 | * Read one character |
||
58 | * |
||
59 | * @param int $count |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function char($count = 1) |
||
70 | |||
71 | /** |
||
72 | * Read the line, but hide what the user is typing |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function hidden() |
||
80 | |||
81 | /** |
||
82 | * Return a valid STDIN, even if it previously EOF'ed |
||
83 | * |
||
84 | * Lazily re-opens STDIN after hitting an EOF |
||
85 | * |
||
86 | * @return resource |
||
87 | * @throws RuntimeException |
||
88 | */ |
||
89 | protected function getStdIn() |
||
103 | |||
104 | /** |
||
105 | * Attempt to set the stdin property |
||
106 | * |
||
107 | * @return void |
||
108 | * @throws RuntimeException |
||
109 | */ |
||
110 | protected function setStdIn() |
||
122 | } |
||
123 |