Ejemplo n.º 1
0
 public function render(MessageCollection $messages)
 {
     $output = '';
     if ($messages->count()) {
         if ($this->wrapOutput) {
             $output .= "<script type=\"text/javascript\">\n";
         }
         foreach ($messages as $message) {
             switch ($message->get('_type')) {
                 case AlertType::ERROR:
                     $output .= $this->renderError($message);
                     break;
                 case AlertType::NOTICE:
                     $output .= $this->renderNotice($message);
                     break;
                 case AlertType::WARNING:
                     $output .= $this->renderWarning($message);
                     break;
                 case AlertType::SUCCESS:
                     $output .= $this->renderSuccess($message);
                     break;
                 default:
                     // Don't know how to handle this type
                     break;
             }
         }
         if ($this->wrapOutput) {
             $output .= "</script>\n";
         }
     }
     return $output;
 }