OutputFormatterStyle
in package
implements
OutputFormatterStyleInterface
Formatter style class for defining styles.
Tags
Table of Contents
Interfaces
- OutputFormatterStyleInterface
- Formatter style interface for defining styles.
Properties
- $background : string
- $color : Color
- $foreground : string
- $handlesHrefGracefully : bool
- $href : string|null
- $options : array<string|int, mixed>
Methods
- __construct() : mixed
- Initializes output formatter style.
- apply() : string
- Applies the style to a given text.
- setBackground() : void
- Sets style background color.
- setForeground() : void
- Sets style foreground color.
- setHref() : void
- setOption() : void
- Sets some specific style option.
- setOptions() : void
- Sets multiple style options at once.
- unsetOption() : void
- Unsets some specific style option.
Properties
$background
private
string
$background
$color
private
Color
$color
$foreground
private
string
$foreground
$handlesHrefGracefully
private
bool
$handlesHrefGracefully
$href
private
string|null
$href
= null
$options
private
array<string|int, mixed>
$options
Methods
__construct()
Initializes output formatter style.
public
__construct([string|null $foreground = null ][, string|null $background = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $foreground : string|null = null
-
The style foreground color name
- $background : string|null = null
-
The style background color name
- $options : array<string|int, mixed> = []
apply()
Applies the style to a given text.
public
apply(string $text) : string
Parameters
- $text : string
Return values
stringsetBackground()
Sets style background color.
public
setBackground([string|null $color = null ]) : void
Parameters
- $color : string|null = null
setForeground()
Sets style foreground color.
public
setForeground([string|null $color = null ]) : void
Parameters
- $color : string|null = null
setHref()
public
setHref(string $url) : void
Parameters
- $url : string
setOption()
Sets some specific style option.
public
setOption(string $option) : void
Parameters
- $option : string
setOptions()
Sets multiple style options at once.
public
setOptions(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
unsetOption()
Unsets some specific style option.
public
unsetOption(string $option) : void
Parameters
- $option : string