Skip to content

Flash

  • Full name: \Qubus\Http\Session\Flash

Properties

msgTypes

protected array $msgTypes

msgWrapper

protected string $msgWrapper

msgBefore

protected string $msgBefore

msgAfter

protected string $msgAfter

closeBtn

protected string $closeBtn

stickyCssClass

protected string $stickyCssClass

msgCssClass

protected string $msgCssClass

cssClassMap

protected array $cssClassMap

redirectUrl

protected ?string $redirectUrl

msgId

public string $msgId

session

public \Qubus\Http\Session\PhpSession $session

Methods

__construct

public __construct(\Qubus\Http\Session\PhpSession $session): mixed

Parameters:

Parameter Type Description
$session \Qubus\Http\Session\PhpSession

Throws:


notice

Notice messages.

public notice(int $num): string

Parameters:

Parameter Type Description
$num int

display

Display the flash messages

public display(mixed|null $types = null, bool $print = true): bool|string

Parameters:

Parameter Type Description
$types mixed|null (null) print all of the message types
(array) print the given message types
(string) print a single message type
$print bool Whether to print the data or return it

hasErrors

See if there are any queued error messages

public hasErrors(): bool

hasMessages

See if there are any queued message

public hasMessages(string|null $type = null): bool

Parameters:

Parameter Type Description
$type string|null The $msgType

formatMessage

Format a message

protected formatMessage(array $msgDataArray, string $type): string

Parameters:

Parameter Type Description
$msgDataArray array Array of message data
$type string The $msgType

Return Value:

The formatted message


doRedirect

Redirect the user if a URL was given.

protected doRedirect(): \Qubus\Http\Session\Flash

clear

Clear the messages from the session data

protected clear(mixed $types = []): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$types mixed (array) Clear all the message types in array.
(string) Only clear the one given message type.

setMsgWrapper

Set the HTML that each message is wrapped in

public setMsgWrapper(string $msgWrapper = ''): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$msgWrapper string The HTML that each message is wrapped in.
Note: Two placeholders (%s) are expected.
The first is the $msgCssClass,
The second is the message text.

setMsgBefore

Prepend string to the message (inside of the message wrapper)

public setMsgBefore(string $msgBefore = ''): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$msgBefore string string to prepend to the message

setMsgAfter

Append string to the message (inside the message wrapper)

public setMsgAfter(string $msgAfter = ''): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$msgAfter string string to append to the message

setCloseBtn

Set the HTML for the close button

public setCloseBtn(string $closeBtn = ''): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$closeBtn string HTML to use for the close button

setStickyCssClass

Set the CSS class for sticky notes

public setStickyCssClass(string $stickyCssClass = ''): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$stickyCssClass string the CSS class to use for sticky messages

setMsgCssClass

Set the CSS class for messages

public setMsgCssClass(string $msgCssClass = ''): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$msgCssClass string The CSS class to use for messages

setCssClassMap

Set the CSS classes for message types

public setCssClassMap(mixed $msgType, mixed|null $cssClass = null): \Qubus\Http\Session\Flash

Parameters:

Parameter Type Description
$msgType mixed (string) The message type
(array) key/value pairs for the class map
$cssClass mixed|null (string) the CSS class to use
(null) not used when $msgType is an array

Inherited methods

info

Add an info message

public info(string $message, string|null $redirectUrl = null, bool $sticky = false): object

Parameters:

Parameter Type Description
$message string The message text
$redirectUrl string|null Where to redirect once the message is added
$sticky bool Sticky the message (hides the close button)

success

Add a success message

public success(string $message, string|null $redirectUrl = null, bool $sticky = false): object

Parameters:

Parameter Type Description
$message string The message text
$redirectUrl string|null Where to redirect once the message is added
$sticky bool Sticky the message (hides the close button)

warning

Add a warning message

public warning(string $message, string|null $redirectUrl = null, bool $sticky = false): object

Parameters:

Parameter Type Description
$message string The message text
$redirectUrl string|null Where to redirect once the message is added
$sticky bool Sticky the message (hides the close button)

error

Add an error message

public error(string $message, string|null $redirectUrl = null, bool $sticky = false): object

Parameters:

Parameter Type Description
$message string The message text
$redirectUrl string|null Where to redirect once the message is added
$sticky bool Sticky the message (hides the close button)

sticky

Add a sticky message

public sticky(string $message, string|null $redirectUrl = null, string $type = MessageType::DEFAULT): object

Parameters:

Parameter Type Description
$message string The message text
$redirectUrl string|null Where to redirect once the message is added
$type string The $msgType

add

Add a flash message to the session data

public add(string $message, string $type = MessageType::DEFAULT, string|null $redirectUrl = null, bool $sticky = false): object|bool

Parameters:

Parameter Type Description
$message string The message text
$type string The $msgType
$redirectUrl string|null Where to redirect once the message is added
$sticky bool Whether the message is stickied


Automatically generated on 2025-10-13