Commit 6ee6f7ba by Taylor Otwell

Refactor messages class.

parent bc0e706c
...@@ -30,8 +30,7 @@ class Messages { ...@@ -30,8 +30,7 @@ class Messages {
*/ */
public function add($key, $message) public function add($key, $message)
{ {
// Make sure the message is not duplicated. if ( ! isset($this->messages[$key]) or array_search($message, $this->messages[$key]) === false)
if ( ! array_key_exists($key, $this->messages) or ! is_array($this->messages[$key]) or ! in_array($message, $this->messages[$key]))
{ {
$this->messages[$key][] = $message; $this->messages[$key][] = $message;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment