Highlighter
in package
Table of Contents
Constants
- CONTAINER_TAG = 'CONTAINER_TAG'
- END_OF_LINE_TAG = 'END_OF_LINE_TAG'
Properties
- $conversionTags : array<string|int, mixed>
- Define tag for html conversion
- $definedStyles : array<string|int, mixed>
- $rgbColors : array<string|int, mixed>
Methods
- closeContainer() : string
- getConversionTag() : string
- getCssStylesFromCode() : array<string|int, mixed>
- Define an array of css styles for a given code and default styles
- getDefaultStyles() : array<string|int, mixed>
- getDefinedStyles() : array<string|int, mixed>
- getRgbColor() : string
- openContainerWithStyles() : string
- setDefinedStyles() : Highlighter
- toHtml() : string
Constants
CONTAINER_TAG
public
mixed
CONTAINER_TAG
= 'CONTAINER_TAG'
END_OF_LINE_TAG
public
mixed
END_OF_LINE_TAG
= 'END_OF_LINE_TAG'
Properties
$conversionTags
Define tag for html conversion
protected
array<string|int, mixed>
$conversionTags
= [self::CONTAINER_TAG => 'span', self::END_OF_LINE_TAG => '<br/>']
$definedStyles
protected
array<string|int, mixed>
$definedStyles
= [
// Format
0 => 'font-weight:normal;text-decoration:none;color:White;background-color:Black',
// Reset all styles
1 => 'font-weight:bold',
// Bold/bright
2 => '',
// Dim ? unknown style
4 => 'text-decoration:underline',
// Underlined
5 => '',
// Blink ? unknown style
7 => '',
// Inverted ? unknown style
8 => 'display:none',
// Hidden
21 => 'font-weight:normal',
// Reset bold/bright
22 => '',
// Reset dim ? unknown style
24 => 'text-decoration:none',
// Reset underlined
25 => 'text-decoration:none',
// Reset blink
27 => '',
// Reset reverse ? unknown style
28 => 'display:inline-block',
// Reset hidden
// Foreground colors
39 => 'color:White',
// Default foreground color
30 => 'color:Black',
// Black
31 => 'color:Red',
// Red
32 => 'color:Green',
// Green
33 => 'color:Yellow',
// Yellow
34 => 'color:Blue',
// Blue
35 => 'color:Magenta',
// Magenta
36 => 'color:Cyan',
// Cyan
37 => 'color:LightGray',
// Light gray
90 => 'color:DarkGray',
// Dark gray
91 => 'color:LightRed',
// Light red
92 => 'color:LightGreen',
// Light green
93 => 'color:LightYellow',
// Light yellow
94 => 'color:LightBlue',
// Light blue
95 => 'color:#F466CC',
// Light magenta
96 => 'color:LightCyan',
// Light cyan
97 => 'color:White',
// White
// Background colors
49 => 'background-color:Black',
// Default background color
40 => 'background-color:Black',
// Black
41 => 'background-color:Red',
// Red
42 => 'background-color:Green',
// Green
43 => 'background-color:Yellow',
// Yellow
44 => 'background-color:Blue',
// Blue
45 => 'background-color:Magenta',
// Magenta
46 => 'background-color:Cyan',
// Cyan
47 => 'background-color:LightGray',
// Light gray
100 => 'background-color:DarkGray',
// Dark gray
101 => 'background-color:LightRed',
// Light red
102 => 'background-color:LightGreen',
// Light green
103 => 'background-color:LightYellow',
// Light yellow
104 => 'background-color:LightBlue',
// Light blue
105 => 'background-color:#F466CC',
// Light magenta
106 => 'background-color:LightCyan',
// Light cyan
107 => 'background-color:White',
]
$rgbColors
protected
array<string|int, mixed>
$rgbColors
= []
Methods
closeContainer()
public
closeContainer() : string
Return values
stringgetConversionTag()
public
getConversionTag(string $tagName) : string
Parameters
- $tagName : string
Tags
Return values
stringgetCssStylesFromCode()
Define an array of css styles for a given code and default styles
public
getCssStylesFromCode(string $code, array<string|int, mixed> $styles) : array<string|int, mixed>
Parameters
- $code : string
- $styles : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaultStyles()
public
getDefaultStyles() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefinedStyles()
public
getDefinedStyles() : array<string|int, mixed>
Return values
array<string|int, mixed>getRgbColor()
public
getRgbColor(int $colorNumber) : string
Parameters
- $colorNumber : int
Tags
Return values
stringopenContainerWithStyles()
public
openContainerWithStyles(array<string|int, mixed> $styles) : string
Parameters
- $styles : array<string|int, mixed>
Return values
stringsetDefinedStyles()
public
setDefinedStyles(array<string|int, mixed> $definedStyles) : Highlighter
Parameters
- $definedStyles : array<string|int, mixed>
Return values
HighlightertoHtml()
public
toHtml(string $subject) : string
Parameters
- $subject : string