refactoring and adding more dependency injection through ioc container.
This commit is contained in:
@@ -12,6 +12,8 @@ class Messages {
|
||||
/**
|
||||
* Create a new Messages instance.
|
||||
*
|
||||
* The Messages class provides a convenient wrapper around an array of generic messages.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($messages = array())
|
||||
@@ -24,6 +26,11 @@ class Messages {
|
||||
*
|
||||
* Duplicate messages will not be added.
|
||||
*
|
||||
* <code>
|
||||
* // Add an error message for the "email" key
|
||||
* $messages->add('email', 'The e-mail address is invalid.');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $message
|
||||
* @return void
|
||||
@@ -39,6 +46,11 @@ class Messages {
|
||||
/**
|
||||
* Determine if messages exist for a given key.
|
||||
*
|
||||
* <code>
|
||||
* // Determine if there are any messages for the "email" key
|
||||
* $has = $messages->has('email');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
@@ -50,6 +62,16 @@ class Messages {
|
||||
/**
|
||||
* Get the first message for a given key.
|
||||
*
|
||||
* Optionally, a format may be specified for the returned message.
|
||||
*
|
||||
* <code>
|
||||
* // Get the first message for the "email" key
|
||||
* $message = $messages->first('email');
|
||||
*
|
||||
* // Get the first message for the "email" key wrapped in <p> tags
|
||||
* $message = $messages->first('email', '<p>:message</p>');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $format
|
||||
* @return string
|
||||
@@ -62,7 +84,13 @@ class Messages {
|
||||
/**
|
||||
* Get all of the messages for a key.
|
||||
*
|
||||
* If no key is specified, all of the messages will be returned.
|
||||
* <code>
|
||||
* // Get all of the messages for the "email" key
|
||||
* $message = $messages->get('email');
|
||||
*
|
||||
* // Get all of the messages for the "email" key wrapped in <p> tags
|
||||
* $message = $messages->get('email', '<p>:message</p>');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $format
|
||||
@@ -76,7 +104,15 @@ class Messages {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the messages.
|
||||
* Get all of the messages for every key.
|
||||
*
|
||||
* <code>
|
||||
* // Get all of the messages for every key
|
||||
* $message = $messages->all();
|
||||
*
|
||||
* // Get all of the messages for every key wrapped in <p> tags
|
||||
* $message = $messages->all('<p>:message</p>');
|
||||
* </code>
|
||||
*
|
||||
* @param string $format
|
||||
* @return array
|
||||
|
||||
Reference in New Issue
Block a user