BookDescription
in package
Advanced book description.
Table of Contents
Properties
- $rawDescription : string|null
Methods
- getDescription() : string|null
- Get the raw description.
- make() : self
- toHtml() : string|null
- Get the description as HTML (remove all tags and new lines except `div`, `p`, `br`, `b`, `i`, `u`, `strong`, `em`).
- toString() : string|null
- Get the description as plain text (remove any HTML tags and new lines).
- toStringMultiline() : string|null
- Get the description as multiline text (remove any HTML tags).
- __construct() : mixed
- cleanDotsAndSpaces() : string
- Clean suspensive dots and remove dots without spaces.
- cleanText() : string
- Clean text from new lines, tabs, dots, and spaces (don't remove HTML tags).
- parseLimit() : string
- removeNewlinesAndTabs() : string
- Remove new lines and tabs from text.
- removeSpacesBeforeTags() : string
- sanitizeHtml() : string|null
- Sanitize HTML, remove all tags except div, p, br, b, i, u, strong, em.
Properties
$rawDescription
protected
string|null
$rawDescription
= null
Methods
getDescription()
Get the raw description.
public
getDescription([int|null $limit = null ]) : string|null
Parameters
- $limit : int|null = null
-
Limit the description length.
Return values
string|nullmake()
public
static make(string|null $description) : self
Parameters
- $description : string|null
Return values
selftoHtml()
Get the description as HTML (remove all tags and new lines except `div`, `p`, `br`, `b`, `i`, `u`, `strong`, `em`).
public
toHtml([int|null $limit = null ]) : string|null
Parameters
- $limit : int|null = null
-
Limit the description length.
Return values
string|nulltoString()
Get the description as plain text (remove any HTML tags and new lines).
public
toString([int|null $limit = null ]) : string|null
Parameters
- $limit : int|null = null
-
Limit the description length.
Return values
string|nulltoStringMultiline()
Get the description as multiline text (remove any HTML tags).
public
toStringMultiline([int|null $limit = null ]) : string|null
Parameters
- $limit : int|null = null
-
Limit the description length.
Return values
string|null__construct()
protected
__construct([string|null $rawDescription = null ]) : mixed
Parameters
- $rawDescription : string|null = null
cleanDotsAndSpaces()
Clean suspensive dots and remove dots without spaces.
private
cleanDotsAndSpaces(string $text) : string
Parameters
- $text : string
Return values
stringcleanText()
Clean text from new lines, tabs, dots, and spaces (don't remove HTML tags).
private
cleanText(string $text[, bool $removeNewlinesAndTabs = true ][, bool $cleanDotsAndSpaces = true ][, bool $removeSpacesBeforeTags = true ]) : string
Parameters
- $text : string
- $removeNewlinesAndTabs : bool = true
- $cleanDotsAndSpaces : bool = true
- $removeSpacesBeforeTags : bool = true
Return values
stringparseLimit()
private
parseLimit(string $text, int|null $limit) : string
Parameters
- $text : string
- $limit : int|null
Return values
stringremoveNewlinesAndTabs()
Remove new lines and tabs from text.
private
removeNewlinesAndTabs(string $text) : string
Parameters
- $text : string
Return values
stringremoveSpacesBeforeTags()
private
removeSpacesBeforeTags(string $text) : string
Parameters
- $text : string
Return values
stringsanitizeHtml()
Sanitize HTML, remove all tags except div, p, br, b, i, u, strong, em.
private
sanitizeHtml(string|null $html) : string|null
Parameters
- $html : string|null