class EncodedHtmlString extends HtmlString

Constants

protected ENCODER_CONTEXT_KEY

Context key for temporarily scoped encoder callbacks.

Properties

protected mixed $html

The HTML string.

from  HtmlString
static protected Closure|null $encodeUsingFactory

The callback that should be used to encode the HTML strings.

Methods

__construct(mixed $html = '', bool $doubleEncode = true)

Create a new encoded HTML string instance.

string
toHtml()

Get the HTML string.

bool
isEmpty()

Determine if the given HTML string is empty.

bool
isNotEmpty()

Determine if the given HTML string is not empty.

string
__toString()

Get the HTML string.

static string
convert(string|null $value, bool $withQuote = true, bool $doubleEncode = true)

Convert the special characters in the given value.

static void
encodeUsing(callable|null $factory = null)

Set the callable that will be used to encode the HTML strings.

static mixed
withEncoding(callable $factory, callable $callback)

Execute the given callback using a temporary encoder.

static void
flushState()

Flush all static state.

Details

at line 29
__construct(mixed $html = '', bool $doubleEncode = true)

Create a new encoded HTML string instance.

Parameters

mixed $html
bool $doubleEncode

at line 49
string toHtml()

Get the HTML string.

Return Value

string

in HtmlString at line 36
bool isEmpty()

Determine if the given HTML string is empty.

Return Value

bool

in HtmlString at line 44
bool isNotEmpty()

Determine if the given HTML string is not empty.

Return Value

bool

in HtmlString at line 52
string __toString()

Get the HTML string.

Return Value

string

at line 39
static string convert(string|null $value, bool $withQuote = true, bool $doubleEncode = true)

internal  
 

Convert the special characters in the given value.

Parameters

string|null $value
bool $withQuote
bool $doubleEncode

Return Value

string

at line 79
static void encodeUsing(callable|null $factory = null)

Set the callable that will be used to encode the HTML strings.

Boot-only. The factory persists in a static property for the worker lifetime and applies to every encoded HTML string.

Parameters

callable|null $factory

Return Value

void

at line 87
static mixed withEncoding(callable $factory, callable $callback)

Execute the given callback using a temporary encoder.

Parameters

callable $factory
callable $callback

Return Value

mixed

at line 110
static void flushState()

Flush all static state.

Return Value

void