Checks the length of a barcode

@param  string $value The barcode to check for proper length
@return boolean
761993
public function checkLength($value)
    {
        if (!is_string($value)) {
            return false;
        }

        $fixum  = strlen($value);
        $found  = false;
        $length = $this->getLength();
        if (is_array($length)) {
            foreach ($length as $value) {
                if ($fixum == $value) {
                    $found = true;
                }

                if ($value == -1) {
                    $found = true;
                }
            }
        } elseif ($fixum == $length) {
            $found = true;
        } elseif ($length == -1) {
            $found = true;
        } elseif ($length == 'even') {
            $count = $fixum % 2;
            $found = ($count == 0) ? true : false;
        } elseif ($length == 'odd') {
            $count = $fixum % 2;
            $found = ($count == 1) ? true : false;
        }

        return $found;
    }
1000801
public function isValueValid($value) {
		return $value instanceof Type\Distance || $value instanceof DataType\NumberType || $value instanceof DataType\TextType;
	}
915292
public static function regon($value)
    {
        $value = preg_replace('#[\\s-]#', '', $value);
        $length = strlen($value);

        if (!($length === 9 || $length === 14)) {
            return false;
        }

        $arrSteps = [8, 9, 2, 3, 4, 5, 6, 7];
        $intSum = 0;

        foreach ($arrSteps as $key => $step) {
            $intSum += $step * $value[$key];
        }

        $int = $intSum % 11;
        $intControlNr = ($int === 10) ? 0 : $int;

        return (string)$intControlNr === $value[8];
    }
848731
public function validate($value)
    {
        if (empty($value)) {
            throw new RuntimeException('Expected a domain value');
        }

        if (strlen($value) > 253) {
            throw new RuntimeException("Specified domain '$value' is too long. Maximum length of 253 characters permitted");
        }

        if (!preg_match('/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i', $value)) {
            throw new RuntimeException("Specified domain '$value' contains illegal characters.");
        }

        if (!preg_match('/^[^\.]{1,63}(\.[^\.]{1,63})*$/', $value)) {
            throw new RuntimeException("Specified domain '$value' contains a segment that is too long. Maximum segment length of 63 characters permitted.");
        }

        return $value;
    }
546316
public function isValid($value) {
		if (! is_string($value)) {
			$this->addMessage('Value must be a string');
		
			return false;
		}
		
		if ($this->lengthMin !== null && $this->lengthMax !== null && $this->lengthMin >= $this->lengthMax) {
			throw new ValidationFailure('Min length cannot be equal or greater than max length');
		}
		
		if ($this->encoding === null) {
			$length = mb_strlen($value);
		} else {
			$length = mb_strlen($value, $this->encoding);
		}
		
		if ($this->lengthMin !== null && $length < $this->lengthMin) {
			$this->addMessage('Must be not less than %s symbols', $this->lengthMin);
		
			return false;
		}
		
		if ($this->lengthMax !== null && $length > $this->lengthMax) {
			$this->addMessage('Must be not more than %s symbols', $this->lengthMax);
		
			return false;
		}
		
		return true;
	}
890307
protected function validateLengthBetween($field, $value, $params)
    {
        $length = $this->stringLength($value);

        return ($length !== false) && $length >= $params[0] && $length <= $params[1];
    }
1170195
public function isValid($value)
    {
        if (!preg_match('/^\+?[0-9]{2,12}$/', $value)) {
            $this->error(self::BAD_SYNTAX);
            return false;
        }
        
        return true;
    }
481555
public static function maxLength($value, $length)
    {
        return Validator::string()->length(null, $length)->validate($value);
    }
340496
protected function validateLength($field, $value, $params)
    {
        $length = $this->stringLength($value);
        // Length between
        if (isset($params[1])) {
            return $length >= $params[0] && $length <= $params[1];
        }

        // Length same
        return ($length !== false) && $length == $params[0];
    }
1102320
public function isValid($value)
    {
        $value = (string) $value;
        if (strlen($value) === 9) {
            $weights = $this->_weights9;
        } elseif (strlen($value) === 14) {
            $weights = $this->_weights14;
        } else {
            $this->_error(self::INVALID_REGON, $value);
            return false;
        }

        $sum = 0;

        for ($i = 0; $i < count($weights); $i++) {
            $sum += $weights[$i] * $value[$i];
        }

        $int = $sum % 11;
        $checksum = ($int === 10) ? 0 : $int;

        if ($checksum !== (int) $value[count($weights)]) {
            $this->_error(self::INVALID_REGON, $value);
            return false;
        }

        return true;
    }
150889
public function Check($value)
    {
        if ($this->trimValue)
            $value = trim($value);
        $result = array();
        if (!preg_match($this->pattern, $value))
            $this->error = self::NoMatch;
        
        return $this->error == '';
    }
44616
private function check($value) {

		if(true === is_string($value)) {
			return false === in_array(preg_match('/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})\z/i', $value), [false, 0]);
		}

		return false;
	}
906948
public function check($value, IValidationData $data = null) {
        if (is_string($value)) {
            $length = strlen($value);

            return $length >= $this->min && $length <= $this->max;
        }

        return false;
    }
420987
protected function isValid($value)
    {
        if (!isset($this->options['locale'])) {
            $locale = $this->localizationService->getConfiguration()->getDefaultLocale();
        } elseif (is_string($this->options['locale'])) {
            $locale = new I18n\Locale($this->options['locale']);
        } elseif ($this->options['locale'] instanceof I18n\Locale) {
            $locale = $this->options['locale'];
        } else {
            $this->addError('The "locale" option can be only set to string identifier, or Locale object.', 1281286579);
            return;
        }

        $strictMode = $this->options['strictMode'];

        $formatLength = $this->options['formatLength'];
        NumbersReader::validateFormatLength($formatLength);

        $formatType = $this->options['formatType'];
        NumbersReader::validateFormatType($formatType);

        if ($formatType === NumbersReader::FORMAT_TYPE_PERCENT) {
            if ($this->numberParser->parsePercentNumber($value, $locale, $formatLength, $strictMode) === false) {
                $this->addError('A valid percent number is expected.', 1281452093);
            }
            return;
        } else {
            if ($this->numberParser->parseDecimalNumber($value, $locale, $formatLength, $strictMode) === false) {
                $this->addError('A valid decimal number is expected.', 1281452094);
            }
        }
    }
1126587
protected function _validate_length($value, $parameter)
    {
        $len = mb_strlen($value);
        if (preg_match('#^(\d+)-(\d+)$#', $parameter, $match)) {
            return $len >= $match[1] && $len <= $match[2] ? $value : null;
        } else {
            throw new InvalidValueException(['length validator `:parameter` parameters is not {minLength}-{maxLength} format', 'parameter' => $parameter]);
        }
    }
408918
public function validate($value = "")
    {
        if (is_null($value) && $this->isEmptyAllowed()) {
            return true;
        }

        if ($this->isNullNotAllowed() && is_null($value)) {
            return false;
        }

        return true;
    }
720629
protected function _code93($value)
    {
        $checksum = substr($value, -2, 2);
        $value    = str_split(substr($value, 0, -2));
        $count    = 0;
        $length   = count($value) % 20;
        foreach($value as $char) {
            if ($length == 0) {
                $length = 20;
            }

            $count += $this->_check[$char] * $length;
            --$length;
        }

        $check   = array_search(($count % 47), $this->_check);
        $value[] = $check;
        $count   = 0;
        $length  = count($value) % 15;
        foreach($value as $char) {
            if ($length == 0) {
                $length = 15;
            }

            $count += $this->_check[$char] * $length;
            --$length;
        }
        $check .= array_search(($count % 47), $this->_check);

        if ($check == $checksum) {
            return true;
        }

        return false;
    }