| 1 | <?php |
||
| 5 | class Windows extends System |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Get the width of the terminal |
||
| 9 | * |
||
| 10 | * @return integer|null |
||
| 11 | */ |
||
| 12 | 8 | public function width() |
|
| 16 | |||
| 17 | /** |
||
| 18 | * Get the height of the terminal |
||
| 19 | * |
||
| 20 | * @return integer|null |
||
| 21 | */ |
||
| 22 | 8 | public function height() |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Get specified terminal dimension |
||
| 29 | * |
||
| 30 | * @param string $key |
||
| 31 | * |
||
| 32 | * @return integer|null |
||
| 33 | */ |
||
| 34 | |||
| 35 | 16 | protected function getDimension($key) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * Get information about the dimensions of the terminal |
||
| 45 | * |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | 16 | protected function getDimensions() |
|
| 49 | { |
||
| 50 | 16 | $output = $this->exec('mode CON', true); |
|
| 51 | |||
| 52 | 16 | if (!is_array($output)) { |
|
| 53 | return []; |
||
| 54 | } |
||
| 55 | |||
| 56 | 16 | $output = implode("\n", $output); |
|
| 57 | |||
| 58 | 16 | preg_match_all('/.*:\s*(\d+)/', $output, $matches); |
|
| 59 | |||
| 60 | 16 | return (!empty($matches[1])) ? $matches[1] : []; |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Check if the stream supports ansi escape characters. |
||
| 65 | * |
||
| 66 | * Based on https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Output/StreamOutput.php |
||
| 67 | * |
||
| 68 | * @return bool |
||
| 69 | */ |
||
| 70 | protected function systemHasAnsiSupport() |
||
| 74 | } |
||
| 75 |