Menu

## FlashMessage
in package

FlashMessage.php : 15

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

#### $instance

FlashMessage.php : 19
`private static FlashMessage|null $instance = null`

#### $messages

FlashMessage.php : 17
`private Collection $messages`

#### $now

FlashMessage.php : 18
`private bool $now = false`

### Methods

#### __call()

FlashMessage.php : 44

Allow simplified method for adding messages

`public __call( $name, $args) : mixed`

##### Parameters

$name :
$args :

##### Return values

mixed —

#### __construct()

FlashMessage.php : 52

FlashMessage constructor.

`public __construct() : mixed`

##### Return values

mixed —

#### each()

FlashMessage.php : 95

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()

FlashMessage.php : 166

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()

FlashMessage.php : 126

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 —

#### instance()

FlashMessage.php : 25

Allows for following the Singleton method and returns the same instance.

`public static instance() : FlashMessage`

##### Return values

FlashMessage —

#### message()

FlashMessage.php : 74

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()

FlashMessage.php : 114

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

`public now() : $this`

##### Return values

$this —

#### showIfExists()

FlashMessage.php : 143

Show a DOM representation of the message if it exists.

`public showIfExists( $name) : mixed`

##### Parameters

$name :

##### Tags

see

  FlashMessage->generateDOMString()

##### Return values

mixed —

#### toArray()

FlashMessage.php : 153

Returns all messages as an array.

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

##### Return values

array<string|int, mixed> —

#### __clone()

FlashMessage.php : 37

Cloning this class is not allowed.

`private __clone() : mixed`

##### Return values

mixed —

## Search results