class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBag, MessageProvider (View source)

Methods

void
__construct( array $messages = array())

Create a new message bag instance.

array
keys()

Get the keys present in the message bag.

$this
add( string $key, string $message)

Add a message to the bag.

$this
merge( MessageProvider|array $messages)

Merge a new array of messages into the bag.

bool
has( string $key = null)

Determine if messages exist for a given key.

string
first( string $key = null, string $format = null)

Get the first message from the bag for a given key.

array
get( string $key, string $format = null)

Get all of the messages from the bag for a given key.

array
all( string $format = null)

Get all of the messages for every key in the bag.

array
unique( string $format = null)

Get all of the unique messages for every key in the bag.

array
messages()

Get the raw messages in the container.

array
getMessages()

Get the raw messages in the container.

getMessageBag()

Get the messages for the instance.

string
getFormat()

Get the default message format.

$this
setFormat( string $format = ':message')

Set the default message format.

bool
isEmpty()

Determine if the message bag has any messages.

bool
any()

Determine if the message bag has any messages.

int
count()

Get the number of messages in the container.

array
toArray()

Get the instance as an array.

array
jsonSerialize()

Convert the object into something JSON serializable.

string
toJson( int $options)

Convert the object to its JSON representation.

string
__toString()

Convert the message bag to its string representation.

Details

at line line 34
void __construct( array $messages = array())

Create a new message bag instance.

Parameters

array $messages

Return Value

void

at line line 46
array keys()

Get the keys present in the message bag.

Return Value

array

at line line 58
$this add( string $key, string $message)

Add a message to the bag.

Parameters

string $key
string $message

Return Value

$this

at line line 73
$this merge( MessageProvider|array $messages)

Merge a new array of messages into the bag.

Parameters

MessageProvider|array $messages

Return Value

$this

at line line 104
bool has( string $key = null)

Determine if messages exist for a given key.

Parameters

string $key

Return Value

bool

at line line 116
string first( string $key = null, string $format = null)

Get the first message from the bag for a given key.

Parameters

string $key
string $format

Return Value

string

at line line 130
array get( string $key, string $format = null)

Get all of the messages from the bag for a given key.

Parameters

string $key
string $format

Return Value

array

at line line 148
array all( string $format = null)

Get all of the messages for every key in the bag.

Parameters

string $format

Return Value

array

at line line 167
array unique( string $format = null)

Get all of the unique messages for every key in the bag.

Parameters

string $format

Return Value

array

at line line 212
array messages()

Get the raw messages in the container.

Return Value

array

at line line 222
array getMessages()

Get the raw messages in the container.

Return Value

array

at line line 232
MessageBag getMessageBag()

Get the messages for the instance.

Return Value

MessageBag

at line line 242
string getFormat()

Get the default message format.

Return Value

string

at line line 253
$this setFormat( string $format = ':message')

Set the default message format.

Parameters

string $format

Return Value

$this

at line line 265
bool isEmpty()

Determine if the message bag has any messages.

Return Value

bool

at line line 275
bool any()

Determine if the message bag has any messages.

Return Value

bool

at line line 285
int count()

Get the number of messages in the container.

Return Value

int

at line line 295
array toArray()

Get the instance as an array.

Return Value

array

at line line 305
array jsonSerialize()

Convert the object into something JSON serializable.

Return Value

array

at line line 316
string toJson( int $options)

Convert the object to its JSON representation.

Parameters

int $options

Return Value

string

at line line 326
string __toString()

Convert the message bag to its string representation.

Return Value

string