Ejemplo n.º 1
0
 public function validate($toValidate)
 {
     $value = $this->getValue($toValidate);
     $str = parent::validate($toValidate);
     if (!$str) {
         return false;
     }
     if (!$this->formatted) {
         // do some cleaning stuff
     }
     return $toValidate;
 }
Ejemplo n.º 2
0
 public function validate($toValidate)
 {
     $isString = parent::validate($toValidate);
     if (!$isString) {
         return false;
     }
     preg_match($this->regex_attr, $isString, $matches);
     $isAttr = count($matches) == 2 && $matches[0] === $matches[1];
     if ($isString && $isAttr) {
         return $toValidate;
     } elseif (!$this->required) {
         return ' ';
     } else {
         return false;
     }
 }