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

Breadcrumb

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

function Terminal::initDimensionsUsingStty

Initializes dimensions using the output of an stty columns line.

1 call to Terminal::initDimensionsUsingStty()
Terminal::initDimensions in vendor/symfony/console/Terminal.php

File

vendor/symfony/console/Terminal.php, line 160

Class

Terminal

Namespace

Symfony\Component\Console

Code

private static function initDimensionsUsingStty() : void {
    if ($sttyString = self::getSttyColumns()) {
        if (preg_match('/rows.(\\d+);.columns.(\\d+);/is', $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/is', $sttyString, $matches)) {
            // extract [w, h] from "; h rows; w columns"
            self::$width = (int) $matches[2];
            self::$height = (int) $matches[1];
        }
    }
}

API Navigation

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