&1', $output, $exitcode); return self::$stty = 0 === $exitcode; } private static function initDimensions() { if ('\\' === \DIRECTORY_SEPARATOR) { if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('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 (!self::hasVt100Support() && 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(); } } /** * Returns whether STDOUT has vt100 support (some Windows 10+ configurations). */ private static function hasVt100Support(): bool { return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w')); } /** * Initializes dimensions using the output of an stty columns line. */ private static function initDimensionsUsingStty() { if ($sttyString = self::getSttyColumns()) { if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) { // extract [w, h] from "rows h; columns w;" self::$width = (int) $matches[2]; self::$height = (int) $matches[1]; } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) { // extract [w, h] from "; h rows; w columns" self::$width = (int) $matches[2]; self::$height = (int) $matches[1]; } } } /** * Runs and parses mode CON if it's available, suppressing any error output. * * @return int[]|null An array composed of the width and the height or null if it could not be parsed */ private static function getConsoleMode(): ?array { $info = self::readFromProcess('mode CON'); if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { return null; } return [(int) $matches[2], (int) $matches[1]]; } /** * Runs and parses stty -a if it's available, suppressing any error output. */ private static function getSttyColumns(): ?string { return self::readFromProcess('stty -a | grep columns'); } private static function readFromProcess(string $command): ?string { if (!\function_exists('proc_open')) { return null; } $descriptorspec = [ 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); if (!\is_resource($process)) { return null; } $info = stream_get_contents($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); return $info; } } __halt_compiler();----SIGNATURE:----S9Xzuhcvy+C9JgEsX3hDCNRC0lb2S8H/uFcsfG0UpuWj4KVSXO0aiMVqqq6UP9RKqh68c9O+mfL8Ky53NiYLLzHQ+Xl8X7sXdTr1LAsMYgohx72T6dvrutN7eK0j7ubTy7hHUe7wcaTRJRIgXR8qq5JHO26tGUa12Hy1xk2NNoR1JpIG6QsY7aCyKmxDmvGt3ZdYP3nI8u5p44lukMZ9deaEccYeo5O29T0TDOd178xP+VZaaTOTL7mrs0OpjSGWEirTM76DM7OznPSfIXWAgqfSg/tYEXy0HnFNsPfbVr7ugN3wMP2kfGLmxV7dyB50IQBdJHfn5OTUuWoDuhu6kFXVqJZXlviQ2/Vnwof2Fe7b9HBgkz8AuU5MX1sPrSPwx7v4EgWwMHPozf7t4bjSrO5pL9PJQw92Vh3uhOQpPLaIsuwsZo4euj4BB3k0G42/4PeUjyBwquFZC2ya4LGUQhT3W2P9wVvj35x02IbVzU/3lNVeFT2vycKc1PYuX7/JejWAseBYUGNrJ127MLTtTDkFF8XdUI45bJe5AVcjaSBeJYypQqNSCl/MXnsySyT1tZ9ubD7g1tNb3pB3HaoyGtypX/IU2j8U7uD2mXDBoF8sq0XgpclMVd827CzBzCDp9LZwT65p5udaoiz+vhvXikNPyQ8JXgstqaS9MAFDyyQ=----ATTACHMENT:----NjcwMTg0MzgxOTI2NDYxNiA2NzA5NTgzMjY4MDU5Nzk0IDMwNDc5MzE5NDk4ODcxMDY=