Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celema\Console; |
| 6 | |
| 7 | /** |
| 8 | * The device behind an Io: where its output goes, where its input comes |
| 9 | * from, and what the device supports. |
| 10 | * |
| 11 | * Stdio talks to the process streams, Buffer captures everything for |
| 12 | * tests. |
| 13 | * |
| 14 | * @api |
| 15 | */ |
| 16 | interface Terminal |
| 17 | { |
| 18 | /** |
| 19 | * Writes the text as is, to the error output with `$error`. |
| 20 | */ |
| 21 | public function write(string $text, bool $error = false): void; |
| 22 | |
| 23 | /** |
| 24 | * Reads one line without its line break; null at the end of input. |
| 25 | * |
| 26 | * With `$hidden`, typing should not be visible. An implementation |
| 27 | * that has a way to hide it must throw when that fails, instead of |
| 28 | * reading visibly; one whose platform offers none reads the line as |
| 29 | * is. |
| 30 | */ |
| 31 | public function read(bool $hidden = false): ?string; |
| 32 | |
| 33 | /** |
| 34 | * Whether the output, or with `$error` the error output, renders |
| 35 | * color codes. |
| 36 | */ |
| 37 | public function colors(bool $error = false): bool; |
| 38 | |
| 39 | /** |
| 40 | * Whether someone can see the prompts and answer them. |
| 41 | */ |
| 42 | public function interactive(): bool; |
| 43 | |
| 44 | /** |
| 45 | * The output width in columns. |
| 46 | */ |
| 47 | public function width(): int; |
| 48 | } |