public function validate(\GGS\Components\Model &$object, $attribute)
 {
     if (empty($object->{$attribute})) {
         return parent::validate($object, $attribute);
     }
     $valid = boolval(filter_var($object->{$attribute}, FILTER_VALIDATE_EMAIL));
     if (!$valid) {
         $this->setError($object, $attribute, 'is not a valid email address');
     }
     return $valid;
 }
 public function validate(\GGS\Components\Model &$object, $attribute)
 {
     if (empty($object->{$attribute})) {
         return parent::validate($object, $attribute);
     }
     $valid = !$this->strict && $this->isSameWhenTypeCasted($object->{$attribute}) || $this->isExactlySameType($object->{$attribute});
     if (!$valid) {
         $this->setError($object, $attribute, 'must be of type ' . $this->type);
     }
     return $valid;
 }
 public function validate(\GGS\Components\Model &$object, $attribute)
 {
     if (empty($object->{$attribute})) {
         return parent::validate($object, $attribute);
     }
     $qualifiedModelClassName = \GGS\Components\Model::getQualifiedModelClassName($this->modelClass);
     $exists = $qualifiedModelClassName::exists(array($this->attribute => $object->{$attribute}));
     if (!$exists) {
         $this->setError($object, $attribute, 'referenced record can not be found');
     }
     return $exists;
 }
 public function validate(\GGS\Components\Model &$object, $attribute)
 {
     if (empty($object->{$attribute})) {
         return parent::validate($object, $attribute);
     }
     $valid = false;
     $errorMessagePrefix = $this->resolveErrorMessagePrefix();
     $comparisonValue = $this->resolveComparisonValue($object, $attribute);
     if (isset($this->exact)) {
         $valid = $comparisonValue == $this->exact;
         if (!$valid) {
             $this->setError($object, $attribute, $errorMessagePrefix . 'must be ' . $this->exact);
         }
     } else {
         if (isset($this->min, $this->max)) {
             $valid = $comparisonValue > $this->min && $comparisonValue < $this->max;
             if (!$valid) {
                 $this->setError($object, $attribute, $errorMessagePrefix . 'must be between ' . ($this->min + 1) . ' - ' . ($this->max - 1));
             }
         } else {
             if (isset($this->min)) {
                 $valid = $comparisonValue > $this->min;
                 if (!$valid) {
                     $this->setError($object, $attribute, $errorMessagePrefix . 'must be greater than ' . $this->min);
                 }
             } else {
                 if (isset($this->max)) {
                     $valid = $comparisonValue < $this->max;
                     if (!$valid) {
                         $this->setError($object, $attribute, $errorMessagePrefix . 'must be less than ' . $this->max);
                     }
                 }
             }
         }
     }
     return $valid;
 }
 public function validate(\GGS\Components\Model &$object, $attribute)
 {
     return parent::validate($object, $attribute);
 }