예제 #1
0
 /**
  * Performs validation
  *
  * The whole rule chain is executed. Note that the side effect of this
  * method is setting the error message on element if validation fails
  *
  * @return   boolean     Whether the element is valid
  */
 public function validate()
 {
     $globalValid = false;
     $localValid = $this->checkValue($this->owner->getValue());
     foreach ($this->chainedRules as $item) {
         foreach ($item as $multiplier) {
             if (!$localValid) {
                 break;
             }
             $localValid = $localValid && $multiplier->validate();
         }
         $globalValid = $globalValid || $localValid;
         if ($globalValid) {
             break;
         }
         $localValid = true;
     }
     if (!$globalValid && strlen($this->message) && !$this->owner->getError()) {
         $this->owner->setError($this->message);
     }
     return $globalValid;
 }
예제 #2
0
파일: Rule.php 프로젝트: grlf/eyedock
 /**
  * Sets the error message on the owner element
  */
 protected function setOwnerError()
 {
     if (strlen($this->getMessage()) && !$this->owner->getError()) {
         $this->owner->setError($this->getMessage());
     }
 }