/** * Determine and return current console height. * * @return false|int */ public function getHeight() { static $height; if ($height > 0) { return $height; } // Try to read console size from ANSICON env var if (preg_match('/\\(\\d+x(\\d+)/', getenv('ANSICON'), $matches)) { $height = $matches[1]; } else { $height = AbstractAdapter::getHeight(); } return $height; }
/** * Determine and return current console height. * * @return false|int */ public function getHeight() { static $height; if ($height > 0) { return $height; } // Try to read console size from "mode" command if ($this->modeResult === null) { $this->runProbeCommand(); } if (preg_match('/Rows\\:\\s+(\\d+)/', $this->modeResult, $matches)) { $height = $matches[1]; } else { $height = parent::getHeight(); } return $height; }
/** * Determine and return current console height. * * @return false|int */ public function getHeight() { static $height; if ($height > 0) { return $height; } // Try to read env variable if (($result = getenv('LINES')) !== false) { return $height = (int) $result; } // Try to read console size from "tput" command $result = exec('tput lines', $output, $return); if (!$return && is_numeric($result)) { return $height = (int) $result; } return $height = parent::getHeight(); }