/**
  * @param mixed $value
  * @return bool
  */
 public function isValid($value)
 {
     if (empty($value) || strlen(trim($value)) == 0) {
         return false;
     }
     if (!$this->alnumValidator->isValid($value)) {
         return false;
     }
     return true;
 }
예제 #2
0
 /**
  * Checks a value without a wildcard.
  * 
  * @param string $value
  * @return boolean
  */
 protected function _isValidSimpleValue($value)
 {
     if ($this->getOption('noDigits')) {
         $validator = new Alpha();
     } else {
         $validator = new Alnum();
     }
     if (!$validator->isValid($value)) {
         $this->error(self::CONTAINS_INVALID_CHARACTERS);
         return false;
     }
     return true;
 }
 /**
  * @param string $token
  * @return bool
  */
 protected function validate($token)
 {
     if (!strpos($token, '_')) {
         $this->error(self::INVALID);
         return false;
     }
     $validator = new AlnumValidator();
     $tokenParts = explode('_', $token);
     if (!$validator->isValid($tokenParts[0]) || !$validator->isValid($tokenParts[1])) {
         $this->error(self::INVALID);
         return false;
     }
     return true;
 }
예제 #4
0
 /**
  * @ZF-7475
  */
 public function testIntegerValidation()
 {
     $this->assertTrue($this->validator->isValid(1));
 }
예제 #5
0
 public static function validateAlnum($value)
 {
     $validator = new Alnum();
     return $validator->isValid($value);
 }