Phalcon\Cli\Environment\Environment::getDimensions PHP Method

getDimensions() public method

Gets the terminal dimensions based on the current environment.
public getDimensions ( ) : array
return array
    public function getDimensions()
    {
        if (!empty($this->dimensions)) {
            return $this->dimensions;
        }
        if ($this->isWindows()) {
            if ($this->isAnsicon() && preg_match('#(?:\\d+x\\d+)\\s+\\((\\d+)x(\\d+)\\)#', trim(getenv('ANSICON')), $match)) {
                // ANSICON maintains an environment variable which holds the current screen size
                // e.g. ANSICON=200x9999 (200x100)
                return [(int) $match[1], (int) $match[2]];
            }
            if (1 === preg_match('/^(\\d+)x(\\d+)$/', $this->getModeCon(), $match)) {
                return [(int) $match[1], (int) $match[2]];
            }
        } elseif (1 === preg_match('/^(\\d+)x(\\d+)$/', $this->getSttySize(), $match)) {
            return [(int) $match[1], (int) $match[2]];
        }
        // fallback mode
        return [EnvironmentInterface::WIDTH, EnvironmentInterface::HEIGHT];
    }