Back to ColorProcessor class

Method __construct

public
__construct
(mixed $noColors = null)
Class constructor
Parameters
  • bool $noColors Defines non-colored mode on construct
Since
  • 4.0.0

Method __construct - Source code

/**
 * Class constructor
 *
 * @param   boolean  $noColors  Defines non-colored mode on construct
 *
 * @since   4.0.0
 */
public function __construct($noColors = null)
{
    if ($noColors === null) {
        /*
         * By default windows cmd.exe and PowerShell does not support ANSI-colored output
         * if the variable is not set explicitly colors should be disabled on Windows
         */
        $noColors = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
    }
    $this->noColors = $noColors;
    $this->addPredefinedStyles();
}