Snaju Inception Docs

FlashMessage

Handles setting and clearing session messages to use for error handling and other purposes.

Table of Contents

$instance  : FlashMessage|null
$messages  : Collection
$now  : bool
__call()  : mixed
Allow simplified method for adding messages
__construct()  : mixed
FlashMessage constructor.
each()  : mixed
Prints all the flash messages either using the default HTML markup or accents a closure to execute. If closure specified, printing will need to be handled by the closure.
generateDOMString()  : string
Generates a DOM representation of the message as a `div` element with the class of "snj-flash-message $type."
get()  : mixed|string
Retrieve the session/flash message. Empty string returned if it doesn't exist.
instance()  : FlashMessage
Allows for following the Singleton method and returns the same instance.
message()  : mixed
Adds a flash message to the collection using a given name/key and message.
now()  : $this
Allow messages to be displayed instantly instead of waiting for the for the next page request.
showIfExists()  : mixed
Show a DOM representation of the message if it exists.
toArray()  : array<string|int, mixed>
Returns all messages as an array.
__clone()  : mixed
Cloning this class is not allowed.

Properties

Methods

__call()

Allow simplified method for adding messages

public __call( $name,  $args) : mixed
Parameters
$name :
$args :
Return values
mixed

__construct()

FlashMessage constructor.

public __construct() : mixed
Return values
mixed

each()

Prints all the flash messages either using the default HTML markup or accents a closure to execute. If closure specified, printing will need to be handled by the closure.

public each([Closure|null $closure = null ]) : mixed
Parameters
$closure : Closure|null = null
Return values
mixed

generateDOMString()

Generates a DOM representation of the message as a `div` element with the class of "snj-flash-message $type."

public generateDOMString(string $type, string $message) : string
Parameters
$type : string
$message : string
Return values
string

get()

Retrieve the session/flash message. Empty string returned if it doesn't exist.

public get(string $name) : mixed|string
Parameters
$name : string
Return values
mixed|string

message()

Adds a flash message to the collection using a given name/key and message.

public message(string $name, string $message) : mixed
Parameters
$name : string
$message : string
Return values
mixed

now()

Allow messages to be displayed instantly instead of waiting for the for the next page request.

public now() : $this
Return values
$this

showIfExists()

Show a DOM representation of the message if it exists.

public showIfExists( $name) : mixed
Parameters
$name :
Tags
see

FlashMessage->generateDOMString()

Return values
mixed

toArray()

Returns all messages as an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

__clone()

Cloning this class is not allowed.

private __clone() : mixed
Return values
mixed

Search results