Commit 8557eb3f authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Aide de vue Messenger : amélioration, refactorisation.

parent 9c074383
......@@ -171,12 +171,7 @@ class Messenger extends AbstractHelper
{
$this->messages = array();
foreach ((array)$messages as $severity => $message) {
if (is_numeric($severity)) {
$severity = 'info';
}
foreach ((array)$message as $m) {
$this->messages[$severity][] = $m;
}
$this->addMessage($severity, $severity);
}
return $this;
}
......@@ -227,6 +222,9 @@ class Messenger extends AbstractHelper
*/
public function addMessage($message, $severity = self::INFO)
{
if (!$severity || !is_string($severity)) {
$severity = self::INFO;
}
$this->messages[$severity][] = $message;
return $this;
}
......@@ -240,7 +238,7 @@ class Messenger extends AbstractHelper
public function addMessages($messages)
{
foreach ($messages as $severity => $message) {
$this->addMessage($message, is_string($severity) ? $severity : null);
$this->addMessage($message, $severity);
}
return $this;
}
......
Supports Markdown
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