Skip to content

Commit 3d28e9e

Browse files
committed
Add dedicated hasStdOutVt100Support method
split: a29636b03fe8066953795439b59e7dd9ebd55c78
1 parent 2084dca commit 3d28e9e

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

Renderer/Partial/Debug/DebuggerTrait.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,30 +178,43 @@ private function getRendererException($error, $code, $line, $offset, $source, $s
178178
), $code, $error);
179179
}
180180

181+
/**
182+
* @return bool
183+
* @codeCoverageIgnore
184+
*/
181185
private function hasColorSupport()
182186
{
183-
// @codeCoverageIgnoreStart
184187
if ('Hyper' === getenv('TERM_PROGRAM') || getenv('BABUN_HOME') !== false) {
185188
return true;
186189
}
187190

188191
if (DIRECTORY_SEPARATOR === '\\') {
189-
return (defined('STDOUT')
190-
&& function_exists('sapi_windows_vt100_support')
191-
&& @sapi_windows_vt100_support(STDOUT)
192-
)
192+
return $this->hasStdOutVt100Support()
193193
|| getenv('ANSICON') !== false
194194
|| getenv('ConEmuANSI') === 'ON'
195195
|| getenv('TERM') === 'xterm';
196196
}
197197

198-
return $this->isATTY();
199-
// @codeCoverageIgnoreEnd
198+
return $this->isStdOutATTY();
200199
}
201200

202-
private function isATTY()
201+
/**
202+
* @return bool
203+
* @codeCoverageIgnore
204+
*/
205+
private function hasStdOutVt100Support()
206+
{
207+
return defined('STDOUT')
208+
&& function_exists('sapi_windows_vt100_support')
209+
&& @sapi_windows_vt100_support(STDOUT);
210+
}
211+
212+
/**
213+
* @return bool
214+
* @codeCoverageIgnore
215+
*/
216+
private function isStdOutATTY()
203217
{
204-
// @codeCoverageIgnoreStart
205218
if (!defined('STDOUT')) {
206219
return false;
207220
}
@@ -218,7 +231,6 @@ private function isATTY()
218231
}
219232

220233
return function_exists('posix_isatty') && @posix_isatty(STDOUT);
221-
// @codeCoverageIgnoreEnd
222234
}
223235

224236
private function getDebuggedException($error, $code, $source, $path, $parameters, $options)

0 commit comments

Comments
 (0)