public function validateValue(Validatable $validateable)
 {
     $response = parent::validateValue($validateable);
     if ($response != null) {
         return $response;
     }
     if (strlen($validateable->getValue()) > $this->maximum) {
         $response = new ValidationResponse($this->getKeyName());
         $response->addValue('maxLength', $this->maximum);
         return $response;
     }
 }
Пример #2
0
 public function validateValue(Validatable $validateable)
 {
     $response = parent::validateValue($validateable);
     if ($response != null) {
         return $response;
     }
     if (preg_match("/" . $this->pattern . "/", $validateable->getValue()) != 1) {
         $response = new ValidationResponse($this->getKeyName(), $validateable->getValue());
         $response->addValue('expression', $this->pattern);
         return $response;
     }
 }