Ejemplo n.º 1
0
 protected function addMessage($message, $type = 'info')
 {
     if (!in_array($type, array('info', 'error', 'warning', 'success'))) {
         throw new ProgrammingError('"%s" is not a valid notification type', $type);
     }
     if ($this->isCli) {
         $msg = sprintf('[%s] %s', $type, $message);
         switch ($type) {
             case 'info':
             case 'success':
                 Logger::info($msg);
                 break;
             case 'warning':
                 Logger::warn($msg);
                 break;
             case 'error':
                 Logger::error($msg);
                 break;
         }
         return;
     }
     $this->messages[] = (object) array('type' => $type, 'message' => $message);
 }