DefaultHighlighter
in package
implements
HighlighterInterface
Tags
Table of Contents
Interfaces
Properties
- $_currentColorIndex : int
- Index of current color for highlighting
- $_doc : HTML
- HTML document for highlighting
- $_highlightColors : array<string|int, mixed>
- List of colors for text highlighting
Methods
- getDocument() : HTML
- Get document for highlighting.
- highlight() : void
- Highlight specified words
- setDocument() : void
- Set document for highlighting.
Properties
$_currentColorIndex
Index of current color for highlighting
protected
int
$_currentColorIndex
= 0
Index is increased at each highlight() call, so terms matching different queries are highlighted using different colors.
$_doc
HTML document for highlighting
protected
HTML
$_doc
$_highlightColors
List of colors for text highlighting
protected
array<string|int, mixed>
$_highlightColors
= array('#66ffff', '#ff66ff', '#ffff66', '#ff8888', '#88ff88', '#8888ff', '#88dddd', '#dd88dd', '#dddd88', '#aaddff', '#aaffdd', '#ddaaff', '#ddffaa', '#ffaadd', '#ffddaa')
Methods
getDocument()
Get document for highlighting.
public
getDocument() : HTML
Return values
HTML —$document
highlight()
Highlight specified words
public
highlight(string|array<string|int, mixed> $words) : void
Parameters
- $words : string|array<string|int, mixed>
-
Words to highlight. They could be organized using the array or string.
setDocument()
Set document for highlighting.
public
setDocument(HTML $document) : void
Parameters
- $document : HTML