public function refreshDimensions()
    {
        if ('\\' === DIRECTORY_SEPARATOR) {
            if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
                // extract [w, H] from "wxh (WxH)"
                // or [w, h] from "wxh"
                $this->width = (int) $matches[1];
                $this->height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
            } elseif (null !== $dimensions = $this->getConsoleMode()) {
                // extract [w, h] from "wxh"
                $this->width = (int) $dimensions[0];
                $this->height = (int) $dimensions[1];
            }
        } elseif ($sttyString = $this->getSttyColumns()) {
            if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
                // extract [w, h] from "rows h; columns w;"
                $this->width = (int) $matches[2];
                $this->height = (int) $matches[1];
            } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
                // extract [w, h] from "; h rows; w columns"
                $this->width = (int) $matches[2];
                $this->height = (int) $matches[1];
            }
        }
        $this->initialised = true;
    }
public function refreshDimensions()
    {
        if ('\\' === DIRECTORY_SEPARATOR) {
            if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
                // extract [w, H] from "wxh (WxH)"
                // or [w, h] from "wxh"
                $this->width = (int) $matches[1];
                $this->height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
            } elseif (null !== $dimensions = $this->getConsoleMode()) {
                // extract [w, h] from "wxh"
                $this->width = (int) $dimensions[0];
                $this->height = (int) $dimensions[1];
            }
        } elseif ($sttyString = $this->getSttyColumns()) {
            if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
                // extract [w, h] from "rows h; columns w;"
                $this->width = (int) $matches[2];
                $this->height = (int) $matches[1];
            } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
                // extract [w, h] from "; h rows; w columns"
                $this->width = (int) $matches[2];
                $this->height = (int) $matches[1];
            }
        }
        $this->initialised = true;
    }
public function refreshDimensions ( ) { if ( '\\' === DIRECTORY_SEPARATOR ) { if ( preg_match ( '/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/' , trim ( getenv ( 'ANSICON' ) ) , $ matches ) ) { // extract [w, H] from "wxh (WxH)" // or [w, h] from "wxh" $ this -> width = ( int ) $ matches [ 1 ] ; $ this -> height = isset ( $ matches [ 4 ] ) ? ( int ) $ matches [ 4 ] : ( int ) $ matches [ 2 ] ; } elseif ( null !== $ dimensions = $ this -> getConsoleMode ( ) ) { // extract [w, h] from "wxh" $ this -> width = ( int ) $ dimensions [ 0 ] ; $ this -> height = ( int ) $ dimensions [ 1 ] ; } } elseif ( $ sttyString = $ this -> getSttyColumns ( ) ) { if ( preg_match ( '/rows.(\d+);.columns.(\d+);/i' , $ sttyString , $ matches ) ) { // extract [w, h] from "rows h; columns w;" $ this -> width = ( int ) $ matches [ 2 ] ; $ this -> height = ( int ) $ matches [ 1 ] ; } elseif ( preg_match ( '/;.(\d+).rows;.(\d+).columns/i' , $ sttyString , $ matches ) ) { // extract [w, h] from "; h rows; w columns" $ this -> width = ( int ) $ matches [ 2 ] ; $ this -> height = ( int ) $ matches [ 1 ] ; } } $ this -> initialised = true ; }
Refresh the current dimensions from the terminal
Refresh the current dimensions from the terminal