/** * Determine whether our CLI output is to a TTY (terminal). I.e. suitable for formatting. * * @return bool */ protected static function is_tty() { if (self::$tty !== null) { return self::$tty; } if (!self::is_cli()) { return self::$tty = false; } if (!function_exists('posix_isatty')) { return self::$tty = (bool) self::$format_if_cannot_detect_tty; } return self::$tty = posix_isatty((bool) STDOUT); }