Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Console.php

function Console::getNumberOfColumnsInteractive

@codeCoverageIgnore

1 call to Console::getNumberOfColumnsInteractive()
Console::getNumberOfColumns in vendor/sebastian/environment/src/Console.php
Returns the number of columns of the terminal.

File

vendor/sebastian/environment/src/Console.php, line 132

Class

Console

Namespace

SebastianBergmann\Environment

Code

private function getNumberOfColumnsInteractive() : int {
    if (function_exists('shell_exec') && preg_match('#\\d+ (\\d+)#', shell_exec('stty size') ?: '', $match) === 1) {
        if ((int) $match[1] > 0) {
            return (int) $match[1];
        }
    }
    if (function_exists('shell_exec') && preg_match('#columns = (\\d+);#', shell_exec('stty') ?: '', $match) === 1) {
        if ((int) $match[1] > 0) {
            return (int) $match[1];
        }
    }
    return 80;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal