public static function getNumberOfColumns(): int
    {
        if (DIRECTORY_SEPARATOR === '\\') {
            $columns = 80;

            if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
                $columns = $matches[1];
            } elseif (function_exists('proc_open')) {
                $process = proc_open(
                    'mode CON',
                    [
                        1 => ['pipe', 'w'],
                        2 => ['pipe', 'w'],
                    ],
                    $pipes,
                    null,
                    null,
                    ['suppress_errors' => true]
                );

                if (is_resource($process)) {
                    $info = stream_get_contents($pipes[1]);
                    fclose($pipes[1]);
                    fclose($pipes[2]);
                    proc_close($process);
                    if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
                        $columns = $matches[2];
                    }
                }
            }

            return $columns - 1;
        }

        if (!self::isInteractive(self::STDIN)) {
            return 80;
        }

        if (preg_match('#\d+ (\d+)#', shell_exec('stty size'), $match) === 1) {
            if ((int)$match[1] > 0) {
                return (int)$match[1];
            }
        }

        if (preg_match('#columns = (\d+);#', shell_exec('stty'), $match) === 1) {
            if ((int)$match[1] > 0) {
                return (int)$match[1];
            }
        }

        return 80;
    }
public static function getNumberOfColumns(): int
    {
        if (DIRECTORY_SEPARATOR === '\\') {
            $columns = 80;

            if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
                $columns = $matches[1];
            } elseif (function_exists('proc_open')) {
                $process = proc_open(
                    'mode CON',
                    [
                        1 => ['pipe', 'w'],
                        2 => ['pipe', 'w'],
                    ],
                    $pipes,
                    null,
                    null,
                    ['suppress_errors' => true]
                );

                if (is_resource($process)) {
                    $info = stream_get_contents($pipes[1]);
                    fclose($pipes[1]);
                    fclose($pipes[2]);
                    proc_close($process);
                    if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
                        $columns = $matches[2];
                    }
                }
            }

            return $columns - 1;
        }

        if (!self::isInteractive(self::STDIN)) {
            return 80;
        }

        if (preg_match('#\d+ (\d+)#', shell_exec('stty size'), $match) === 1) {
            if ((int)$match[1] > 0) {
                return (int)$match[1];
            }
        }

        if (preg_match('#columns = (\d+);#', shell_exec('stty'), $match) === 1) {
            if ((int)$match[1] > 0) {
                return (int)$match[1];
            }
        }

        return 80;
    }
public static function getNumberOfColumns ( ) : int { if ( DIRECTORY_SEPARATOR === '\\' ) { $ columns = 80 ; if ( preg_match ( '/^(\d+)x\d+ \(\d+x(\d+)\)$/' , trim ( getenv ( 'ANSICON' ) ) , $ matches ) ) { $ columns = $ matches [ 1 ] ; } elseif ( function_exists ( 'proc_open' ) ) { $ process = proc_open ( 'mode CON' , [ 1 => [ 'pipe' , 'w' ] , 2 => [ 'pipe' , 'w' ] , ] , $ pipes , null , null , [ 'suppress_errors' => true ] ) ; if ( is_resource ( $ process ) ) { $ info = stream_get_contents ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 2 ] ) ; proc_close ( $ process ) ; if ( preg_match ( '/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/' , $ info , $ matches ) ) { $ columns = $ matches [ 2 ] ; } } } return $ columns - 1 ; } if ( ! self :: isInteractive ( self :: STDIN ) ) { return 80 ; } if ( preg_match ( '#\d+ (\d+)#' , shell_exec ( 'stty size' ) , $ match ) === 1 ) { if ( ( int ) $ match [ 1 ] > 0 ) { return ( int ) $ match [ 1 ] ; } } if ( preg_match ( '#columns = (\d+);#' , shell_exec ( 'stty' ) , $ match ) === 1 ) { if ( ( int ) $ match [ 1 ] > 0 ) { return ( int ) $ match [ 1 ] ; } } return 80 ; }
Returns the number of columns of the terminal.

@return int
@codeCoverageIgnore
Returns the number of columns of the terminal .