src/mako/cli/Environment.php
protected function getDimensionsForUnixLike(): ?array
	{
		// Attempt to get dimensions from environment

		if(($width = getenv('COLUMNS')) !== false && ($height = getenv('LINES')) !== false)
		{
			return ['width' => (int) $width, 'height' => (int) $height];
		}

		// Attempt to get dimensions from stty

		exec('stty size', $output, $status);

		if($status === 0 && preg_match('/^([0-9]+) ([0-9]+)$/', current($output), $matches))
		{
			return ['width' => (int) $matches[2], 'height' => (int) $matches[1]];
		}

		// All attempts failed so we'll just return null

		return null;
	}
protected function getDimensionsForUnixLike(): ?array
	{
		// Attempt to get dimensions from environment

		if(($width = getenv('COLUMNS')) !== false && ($height = getenv('LINES')) !== false)
		{
			return ['width' => (int) $width, 'height' => (int) $height];
		}

		// Attempt to get dimensions from stty

		exec('stty size', $output, $status);

		if($status === 0 && preg_match('/^([0-9]+) ([0-9]+)$/', current($output), $matches))
		{
			return ['width' => (int) $matches[2], 'height' => (int) $matches[1]];
		}

		// All attempts failed so we'll just return null

		return null;
	}
protected function getDimensionsForUnixLike ( ) : ? array { // Attempt to get dimensions from environment if ( ( $ width = getenv ( 'COLUMNS' ) ) !== false && ( $ height = getenv ( 'LINES' ) ) !== false ) { return [ 'width' => ( int ) $ width , 'height' => ( int ) $ height ] ; } // Attempt to get dimensions from stty exec ( 'stty size' , $ output , $ status ) ; if ( $ status === 0 && preg_match ( '/^([0-9]+) ([0-9]+)$/' , current ( $ output ) , $ matches ) ) { return [ 'width' => ( int ) $ matches [ 2 ] , 'height' => ( int ) $ matches [ 1 ] ] ; } // All attempts failed so we'll just return null return null ; }
Attempts to get dimensions for Unix-like platforms.

@return array|null
Attempts to get dimensions for Unix - like platforms .