Documentation

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

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|null

make()

public static make(string|null $description) : self
Parameters
$description : string|null
Return values
self

toHtml()

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|null

toString()

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|null

toStringMultiline()

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
string

cleanText()

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
string

parseLimit()

private parseLimit(string $text, int|null $limit) : string
Parameters
$text : string
$limit : int|null
Return values
string

removeNewlinesAndTabs()

Remove new lines and tabs from text.

private removeNewlinesAndTabs(string $text) : string
Parameters
$text : string
Return values
string

removeSpacesBeforeTags()

private removeSpacesBeforeTags(string $text) : string
Parameters
$text : string
Return values
string

sanitizeHtml()

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
Return values
string|null

        
On this page

Search results