예제 #1
0
파일: Between.php 프로젝트: kylesm87/Clutch
 public function validate($value, $valueIdentifier = null)
 {
     $this->value = $value;
     $minValidator = new LessThan();
     if (isset($this->options['max'])) {
         $minValidator->setOption('max', $this->options['max']);
     }
     $maxValidator = new GreaterThan();
     if (isset($this->options['min'])) {
         $maxValidator->setOption('min', $this->options['min']);
     }
     $this->success = $minValidator->validate($value, $valueIdentifier) && $maxValidator->validate($value, $valueIdentifier);
     return $this->success;
 }
 /**
  * @inheritdoc
  */
 public function matches($data)
 {
     $gt = new LessThan($this->value);
     $e = new Equal($this->value);
     return $gt->matches($data) || $e->matches($data);
 }