TYPO3  7.6
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
OutputFormatterStyle Class Reference
Inheritance diagram for OutputFormatterStyle:
OutputFormatterStyleInterface

Public Member Functions

 __construct ($foreground=null, $background=null, array $options=array())
 
 setForeground ($color=null)
 
 setBackground ($color=null)
 
 setOption ($option)
 
 unsetOption ($option)
 
 setOptions (array $options)
 
 apply ($text)
 

Private Attributes

 $foreground
 
 $background
 
 $options = array()
 

Static Private Attributes

static $availableForegroundColors
 
static $availableBackgroundColors
 
static $availableOptions
 

Detailed Description

Formatter style class for defining styles.

Author
Konstantin Kudryashov ever..nosp@m.zet@.nosp@m.gmail.nosp@m..com

Definition at line 21 of file OutputFormatterStyle.php.

Constructor & Destructor Documentation

__construct (   $foreground = null,
  $background = null,
array  $options = array() 
)

Initializes output formatter style.

Parameters
string | null$foregroundThe style foreground color name
string | null$backgroundThe style background color name
array$optionsThe style options

Definition at line 66 of file OutputFormatterStyle.php.

References OutputFormatterStyle\$background, OutputFormatterStyle\$foreground, OutputFormatterStyle\$options, OutputFormatterStyle\setBackground(), OutputFormatterStyle\setForeground(), and OutputFormatterStyle\setOptions().

Member Function Documentation

apply (   $text)

Applies the style to a given text.

Parameters
string$textThe text to style
Returns
string

Implements OutputFormatterStyleInterface.

Definition at line 203 of file OutputFormatterStyle.php.

setBackground (   $color = null)

Sets style background color.

Parameters
string | null$colorThe color name
Exceptions
\InvalidArgumentExceptionWhen the color name isn't defined

Implements OutputFormatterStyleInterface.

Definition at line 116 of file OutputFormatterStyle.php.

Referenced by OutputFormatterStyle\__construct().

setForeground (   $color = null)

Sets style foreground color.

Parameters
string | null$colorThe color name
Exceptions
\InvalidArgumentExceptionWhen the color name isn't defined

Implements OutputFormatterStyleInterface.

Definition at line 88 of file OutputFormatterStyle.php.

Referenced by OutputFormatterStyle\__construct().

setOption (   $option)

Sets some specific style option.

Parameters
string$optionThe option name
Exceptions
\InvalidArgumentExceptionWhen the option name isn't defined

Implements OutputFormatterStyleInterface.

Definition at line 144 of file OutputFormatterStyle.php.

Referenced by OutputFormatterStyle\setOptions().

setOptions ( array  $options)

Sets multiple style options at once.

Parameters
array$options

Implements OutputFormatterStyleInterface.

Definition at line 187 of file OutputFormatterStyle.php.

References OutputFormatterStyle\setOption().

Referenced by OutputFormatterStyle\__construct().

unsetOption (   $option)

Unsets some specific style option.

Parameters
string$optionThe option name
Exceptions
\InvalidArgumentExceptionWhen the option name isn't defined

Implements OutputFormatterStyleInterface.

Definition at line 166 of file OutputFormatterStyle.php.

Member Data Documentation

$availableBackgroundColors
staticprivate
Initial value:
= array(
'black' => array('set' => 40, 'unset' => 49),
'red' => array('set' => 41, 'unset' => 49),
'green' => array('set' => 42, 'unset' => 49),
'yellow' => array('set' => 43, 'unset' => 49),
'blue' => array('set' => 44, 'unset' => 49),
'magenta' => array('set' => 45, 'unset' => 49),
'cyan' => array('set' => 46, 'unset' => 49),
'white' => array('set' => 47, 'unset' => 49),
'default' => array('set' => 49, 'unset' => 49),
)

Definition at line 34 of file OutputFormatterStyle.php.

$availableForegroundColors
staticprivate
Initial value:
= array(
'black' => array('set' => 30, 'unset' => 39),
'red' => array('set' => 31, 'unset' => 39),
'green' => array('set' => 32, 'unset' => 39),
'yellow' => array('set' => 33, 'unset' => 39),
'blue' => array('set' => 34, 'unset' => 39),
'magenta' => array('set' => 35, 'unset' => 39),
'cyan' => array('set' => 36, 'unset' => 39),
'white' => array('set' => 37, 'unset' => 39),
'default' => array('set' => 39, 'unset' => 39),
)

Definition at line 23 of file OutputFormatterStyle.php.

$availableOptions
staticprivate
Initial value:
= array(
'bold' => array('set' => 1, 'unset' => 22),
'underscore' => array('set' => 4, 'unset' => 24),
'blink' => array('set' => 5, 'unset' => 25),
'reverse' => array('set' => 7, 'unset' => 27),
'conceal' => array('set' => 8, 'unset' => 28),
)

Definition at line 45 of file OutputFormatterStyle.php.

$background
private

Definition at line 54 of file OutputFormatterStyle.php.

Referenced by OutputFormatterStyle\__construct().

$foreground
private

Definition at line 53 of file OutputFormatterStyle.php.

Referenced by OutputFormatterStyle\__construct().

$options = array()
private

Definition at line 55 of file OutputFormatterStyle.php.

Referenced by OutputFormatterStyle\__construct().