示例#1
0
 /**
  * Returns the messages generated in the validation
  *
  * @param boolean|null $byItemName
  * @return array
  * @throws Exception
  */
 public function getMessages($byItemName = null)
 {
     if (is_null($byItemName) === true) {
         $byItemName = false;
     } elseif (is_bool($byItemName) === false) {
         throw new Exception('Invalid parameter type.');
     }
     $messages = $this->_messages;
     if ($byItemName === true) {
         if (is_array($messages) === false) {
             return new Group();
         }
         return $messages;
     }
     $g = new Group();
     if (is_array($messages) === true) {
         foreach ($messages as $message) {
             $g->appendMessages($message);
         }
     }
     return $g;
 }
示例#2
0
 public function appendMessages($messages)
 {
     parent::appendMessages($messages);
 }