PHP Class Bluz\Messages\Messages

Author: Anton Shevchuk
Inheritance: use trait Bluz\Common\Options
Show file Open project: bluzphp/framework Class Usage Examples

Protected Properties

Property Type Description
$types list of messages types

Public Methods

Method Description
addError ( string $message, variadic $text ) : void Add error
addNotice ( string $message, variadic $text ) : void Add notice
addSuccess ( string $message, variadic $text ) : void Add success
count ( ) : integer Get size of messages container
pop ( string $type = null ) : stdClass | null Pop a message
popAll ( ) : array Pop all messages
reset ( ) : void Reset messages

Protected Methods

Method Description
add ( string $type, string $message, variadic $text ) : void Add message to container
createEmptyMessagesStore ( ) : ArrayObject Creates a new empty store for messages
getMessagesStore ( ) : ArrayObject | null Returns current messages store
init ( ) : Messages Initialize Messages container

Method Details

add() protected method

Add message to container
protected add ( string $type, string $message, variadic $text ) : void
$type string One of error, notice or success
$message string
$text variadic
return void

addError() public method

Add error
Since: 1.0.0 added $text
public addError ( string $message, variadic $text ) : void
$message string
$text variadic
return void

addNotice() public method

Add notice
Since: 1.0.0 added $text
public addNotice ( string $message, variadic $text ) : void
$message string
$text variadic
return void

addSuccess() public method

Add success
Since: 1.0.0 added $text
public addSuccess ( string $message, variadic $text ) : void
$message string
$text variadic
return void

count() public method

Get size of messages container
public count ( ) : integer
return integer

createEmptyMessagesStore() protected method

Creates a new empty store for messages
protected createEmptyMessagesStore ( ) : ArrayObject
return ArrayObject

getMessagesStore() protected method

Returns current messages store
protected getMessagesStore ( ) : ArrayObject | null
return ArrayObject | null Returns null if store not exists yet

init() protected method

Initialize Messages container
protected init ( ) : Messages
return Messages

pop() public method

Pop a message
public pop ( string $type = null ) : stdClass | null
$type string
return stdClass | null

popAll() public method

Pop all messages
public popAll ( ) : array
return array

reset() public method

Reset messages
public reset ( ) : void
return void

Property Details

$types protected property

list of messages types
protected $types