FlashMessage extends AbstractMessage

A class representing flash messages.

Table of Contents

Properties

$message  : string
$severity  : ContextualFeedbackSeverity
$storeInSession  : bool
Defines whether the message should be stored in the session (to survive redirects) or only for one request (default)
$title  : string

Methods

__construct()  : mixed
Constructor for a flash message
__toString()  : string
Creates a string representation of the message. Useful for command line use.
createFromArray()  : self
Factory method. Useful when creating flash messages from a jsonSerialize json_decode() call.
getMessage()  : string
getSeverity()  : ContextualFeedbackSeverity
getTitle()  : string
isSessionMessage()  : bool
Gets the message's storeInSession flag.
jsonSerialize()  : array<string|int, mixed>
setMessage()  : void
setSeverity()  : void
Sets the message' severity
setStoreInSession()  : mixed
Sets the message's storeInSession flag
setTitle()  : void

Properties

$storeInSession

Defines whether the message should be stored in the session (to survive redirects) or only for one request (default)

protected bool $storeInSession = false

Methods

__construct()

Constructor for a flash message

public __construct(string $message[, string $title = '' ][, ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = false ]) : mixed
Parameters
$message : string

The message.

$title : string = ''

Optional message title.

$severity : ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
$storeInSession : bool = false

Optional, defines whether the message should be stored in the session or only for one request (default)

__toString()

Creates a string representation of the message. Useful for command line use.

public __toString() : string
Return values
string

A string representation of the message.

createFromArray()

Factory method. Useful when creating flash messages from a jsonSerialize json_decode() call.

public static createFromArray(array<string, string|int|bool> $data) : self
Parameters
$data : array<string, string|int|bool>
Return values
self

getMessage()

public getMessage() : string
Return values
string

getTitle()

public getTitle() : string
Return values
string

isSessionMessage()

Gets the message's storeInSession flag.

public isSessionMessage() : bool
Return values
bool

TRUE if message should be stored in the session, otherwise FALSE.

jsonSerialize()

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

Data which can be serialized by json_encode()

setMessage()

public setMessage(string $message) : void
Parameters
$message : string

setStoreInSession()

Sets the message's storeInSession flag

public setStoreInSession(bool $storeInSession) : mixed
Parameters
$storeInSession : bool

The persistence flag

setTitle()

public setTitle(string $title) : void
Parameters
$title : string

        
On this page

Search results