public function addValidationError(\Nethgui\Module\ModuleInterface $module, $parameterName, \Nethgui\System\ValidatorInterface $validator)
 {
     $failureInfoList = $validator->getFailureInfo();
     if (empty($failureInfoList)) {
         throw new \LogicException(sprintf('%s: the validator does not have any failure information', __CLASS__), 1403709455);
     }
     foreach ($failureInfoList as $failureInfo) {
         if (!isset($failureInfo[1])) {
             throw new \LogicException(sprintf('%s: invalid failure info struct', __CLASS__), 1403709456);
         }
         $this->addValidationErrorMessage($module, $parameterName, $failureInfo[0], $failureInfo[1]);
     }
     return $this;
 }
Example #2
0
 public function evaluate($value)
 {
     $this->failureInfo = array();
     $e1 = $this->v1->evaluate($value);
     if ($e1 === FALSE) {
         $e2 = $this->v2->evaluate($value);
         if ($e2 === FALSE) {
             $this->failureInfo = array_merge($this->failureInfo, $this->v1->getFailureInfo(), $this->v2->getFailureInfo());
             return FALSE;
         }
         return TRUE;
     }
     return TRUE;
 }