Refactor messages class.
This commit is contained in:
parent
bc0e706c02
commit
6ee6f7ba22
|
@ -30,8 +30,7 @@ public function __construct($messages = array())
|
|||
*/
|
||||
public function add($key, $message)
|
||||
{
|
||||
// Make sure the message is not duplicated.
|
||||
if ( ! array_key_exists($key, $this->messages) or ! is_array($this->messages[$key]) or ! in_array($message, $this->messages[$key]))
|
||||
if ( ! isset($this->messages[$key]) or array_search($message, $this->messages[$key]) === false)
|
||||
{
|
||||
$this->messages[$key][] = $message;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue