function Terminal::initDimensions
2 calls to Terminal::initDimensions()
- Terminal::getHeight in vendor/
symfony/ console/ Terminal.php - Gets the terminal height.
- Terminal::getWidth in vendor/
symfony/ console/ Terminal.php - Gets the terminal width.
File
-
vendor/
symfony/ console/ Terminal.php, line 134
Class
Namespace
Symfony\Component\ConsoleCode
private static function initDimensions() : void {
if ('\\' === \DIRECTORY_SEPARATOR) {
$ansicon = getenv('ANSICON');
if (false !== $ansicon && preg_match('/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/', trim($ansicon), $matches)) {
// extract [w, H] from "wxh (WxH)"
// or [w, h] from "wxh"
self::$width = (int) $matches[1];
self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
}
elseif (!sapi_windows_vt100_support(fopen('php://stdout', 'w')) && self::hasSttyAvailable()) {
// only use stty on Windows if the terminal does not support vt100 (e.g. Windows 7 + git-bash)
// testing for stty in a Windows 10 vt100-enabled console will implicitly disable vt100 support on STDOUT
self::initDimensionsUsingStty();
}
elseif (null !== ($dimensions = self::getConsoleMode())) {
// extract [w, h] from "wxh"
self::$width = (int) $dimensions[0];
self::$height = (int) $dimensions[1];
}
}
else {
self::initDimensionsUsingStty();
}
}