Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/console/Terminal.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
54 return self::$height ?: 50; | 54 return self::$height ?: 50; |
55 } | 55 } |
56 | 56 |
57 private static function initDimensions() | 57 private static function initDimensions() |
58 { | 58 { |
59 if ('\\' === DIRECTORY_SEPARATOR) { | 59 if ('\\' === \DIRECTORY_SEPARATOR) { |
60 if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { | 60 if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { |
61 // extract [w, H] from "wxh (WxH)" | 61 // extract [w, H] from "wxh (WxH)" |
62 // or [w, h] from "wxh" | 62 // or [w, h] from "wxh" |
63 self::$width = (int) $matches[1]; | 63 self::$width = (int) $matches[1]; |
64 self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2]; | 64 self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2]; |
85 * | 85 * |
86 * @return int[]|null An array composed of the width and the height or null if it could not be parsed | 86 * @return int[]|null An array composed of the width and the height or null if it could not be parsed |
87 */ | 87 */ |
88 private static function getConsoleMode() | 88 private static function getConsoleMode() |
89 { | 89 { |
90 if (!function_exists('proc_open')) { | 90 if (!\function_exists('proc_open')) { |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 $descriptorspec = array( | 94 $descriptorspec = [ |
95 1 => array('pipe', 'w'), | 95 1 => ['pipe', 'w'], |
96 2 => array('pipe', 'w'), | 96 2 => ['pipe', 'w'], |
97 ); | 97 ]; |
98 $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); | 98 $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); |
99 if (is_resource($process)) { | 99 if (\is_resource($process)) { |
100 $info = stream_get_contents($pipes[1]); | 100 $info = stream_get_contents($pipes[1]); |
101 fclose($pipes[1]); | 101 fclose($pipes[1]); |
102 fclose($pipes[2]); | 102 fclose($pipes[2]); |
103 proc_close($process); | 103 proc_close($process); |
104 | 104 |
105 if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { | 105 if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { |
106 return array((int) $matches[2], (int) $matches[1]); | 106 return [(int) $matches[2], (int) $matches[1]]; |
107 } | 107 } |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 /** | 111 /** |
113 * | 113 * |
114 * @return string|null | 114 * @return string|null |
115 */ | 115 */ |
116 private static function getSttyColumns() | 116 private static function getSttyColumns() |
117 { | 117 { |
118 if (!function_exists('proc_open')) { | 118 if (!\function_exists('proc_open')) { |
119 return; | 119 return; |
120 } | 120 } |
121 | 121 |
122 $descriptorspec = array( | 122 $descriptorspec = [ |
123 1 => array('pipe', 'w'), | 123 1 => ['pipe', 'w'], |
124 2 => array('pipe', 'w'), | 124 2 => ['pipe', 'w'], |
125 ); | 125 ]; |
126 | 126 |
127 $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); | 127 $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); |
128 if (is_resource($process)) { | 128 if (\is_resource($process)) { |
129 $info = stream_get_contents($pipes[1]); | 129 $info = stream_get_contents($pipes[1]); |
130 fclose($pipes[1]); | 130 fclose($pipes[1]); |
131 fclose($pipes[2]); | 131 fclose($pipes[2]); |
132 proc_close($process); | 132 proc_close($process); |
133 | 133 |