Console
in package
Table of Contents
- STDERR = 2
- STDIN = 0
- STDOUT = 1
- getNumberOfColumns() : int
- Returns the number of columns of the terminal.
- hasColorSupport() : bool
- Returns true if STDOUT supports colorization.
- isInteractive() : bool
- Returns if the file descriptor is an interactive terminal or not.
- getNumberOfColumnsInteractive() : int
- getNumberOfColumnsWindows() : int
- isWindows() : bool
Constants
STDERR
public
int
STDERR
= 2
STDIN
public
int
STDIN
= 0
STDOUT
public
int
STDOUT
= 1
Methods
getNumberOfColumns()
Returns the number of columns of the terminal.
public
getNumberOfColumns() : int
Tags
Return values
int —hasColorSupport()
Returns true if STDOUT supports colorization.
public
hasColorSupport() : bool
This code has been copied and adapted from Symfony\Component\Console\Output\StreamOutput.
Return values
bool —isInteractive()
Returns if the file descriptor is an interactive terminal or not.
public
isInteractive([int|resource $fileDescriptor = self::STDOUT ]) : bool
Normally, we want to use a resource as a parameter, yet sadly it's not always awailable,
eg when running code in interactive console (php -a
), STDIN/STDOUT/STDERR constants are not defined.
Parameters
- $fileDescriptor : int|resource = self::STDOUT
Return values
bool —getNumberOfColumnsInteractive()
private
getNumberOfColumnsInteractive() : int
Tags
Return values
int —getNumberOfColumnsWindows()
private
getNumberOfColumnsWindows() : int
Tags
Return values
int —isWindows()
private
isWindows() : bool