@param string $input

@return bool
17430
public function validate($input)
    {
        switch (strlen($input)) {
            // YYMMDDAABB
            case 10:
                $parsed = $input;
                break;

            case 11: // YYMMDD[-+]AABB
                $parsed = str_replace(array('-', '+'), '', $input);
                break;

            // YYYYMMDDAABB
            case 12:
                $parsed = substr($input, 2);
                break;

            case 13: // YYYYYYMMDD[-+]AABB
                $parsed = substr($input, 2);
                $parsed = str_replace(array('-', '+'), '', $parsed);
                break;

            default:
                return false;
        }

        if (!preg_match('/^\d+$/', $parsed)) {
            return false;
        }

        // Use DateTime to parse the date and see if it changes
        $date     = substr($parsed, 0, 6);
        $dateTime = \DateTime::createFromFormat('ymd', $date);

        // If it changes, it wasn't a valid date (since 991232 will yield 000101)
        if ($dateTime->format('ymd') !== $date) {
            return false;
        }

        // Get check number
        $check  = intval(substr($parsed, -1, 1));
        $parsed = substr($parsed, 0, 9);

        $result = 0;

        // Calculate check number
        for ($i = 0; $i < strlen($parsed); $i++) {

            if (($i % 2) == 0) {
                $number = intval($parsed[$i] * 2);
            } else {
                $number = intval($parsed[$i]);
            }

            if ($number > 9) {
                $result += (1 + ($number % 10));
            } else {
                $result += $number;
            }
        }

        return ((($check + $result) % 10) == 0);
    }
1202072
protected function scan( $input )
	{
		static $regex;
		if ( !isset( $regex ) )
		{
			$regex = sprintf( '/(%s)|%s/%s', implode( ')|(', $this->getCatchablePatterns() ), implode( '|', $this->getNonCatchablePatterns() ), $this->getModifiers() );
		}
		$flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
		$matches = preg_split( $regex, $input, -1, $flags );
		foreach ( $matches as $match )
		{
			// Must remain before 'value' assignment since it can change content
			$type = $this->getType( $match[0] );
			$this->tokens[] = [
				'value' => $match[0],
				'type' => $type,
				'position' => $match[1],
			];
		}
	}
871529
protected function containsSpecialChars($input)
    {
        $special_chars = str_split($this->lineTerminator, 1);
        $special_chars[] = $this->quotechar;
        $special_chars[] = $this->delimiter;
        foreach ($special_chars as $char) {
            if (strpos($input, $char) !== false) {
                return true;
            }
        }

        return false;
    }
241251
protected function isId($input)
    {
        // Assume false result
        $result = false;

        // Make the search easier
        $input = strtolower($input);

        // We got the Id field if the first 2 or the last 2 characters are === id (e.g. IdMessages, MessageId, Id, ...)
        if (substr($input, 0, 2) === 'id' || substr($input, -2, 2) === 'id') {
            $result = true;
        }

        return $result;
    }
1058244
public function validate($input): bool
    {
        $input = (string)$input;
        // check by regular expression
        if (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $input)
            && preg_match("/^.{1,253}$/", $input)
            && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $input)
        ) {
            // check by DNS record
            if ($this->checkDns) {
                return checkdnsrr($input, 'A');
            }
            return true;
        }
        return false;
    }
605217
public function parse(array $input): bool
    {
        $this->resetAggregators();

        $this
            ->validateType($input)
            ->validateId($input)
            ->validateAttributes($input)
            ->validateRelationships($input);

        $hasNoErrors = $this->getJsonApiErrorCollection()->count() <= 0;

        return $hasNoErrors;
    }
563538
public function getLength($input)
    {
        if (is_scalar($input)) {
            if ($this->countByChars) {
                return mb_strlen($input, $this->charset);
            } else {
                return strlen($input);
            }
        } elseif (is_array($input) || $input instanceof \Countable) {
            return count($input);
        } else {
            return false;
        }
    }
1361734
public function match($input)
    {
        // Match the input with the regex pattern, storing any match found into the $matches variable,
        // along with the index of the string at which it was matched.
        $result = preg_match($this->pattern, $input, $matches, PREG_OFFSET_CAPTURE);

        // preg_match returns false if an error occured
        if ($result === false)
            throw new \Exception(preg_last_error());

        // 0 means no match was found
        if ($result === 0)
            return null;

        return $this->getTokenFromMatch($matches[0]);
    }
1006208
public static function clearInput($input)
    {
        if (is_array($input)) {
            foreach ($input as $key => $value) {
                if (!isset($value) || $value === '') {
                    unset($input[$key]);
                }
            }

            return $input;
        }

        return $input;
    }
450176
public function validate($input): bool
    {
        if (!$length = $this->extractLength($input)) {
            return false;
        }

        return (null === $this->minValue || $this->less($this->minValue, $length))
            && (null === $this->maxValue || $this->less($length, $this->maxValue));
    }
406218
protected function resolve(Input $input): Input
    {
        $this->call($input->value());
        $input->ignore();

        return $input;
    }
1109229
public function verifySalt($input)
    {
        $appearsValid = (1 === preg_match('/^_[\.\/0-9A-Za-z]{8}$/', $input));
        if ($appearsValid) {
            $costFactor = $this->_decodeInt24(substr($input, 1, 4));
            if ($costFactor < 1 || $costFactor > (1 << 24) - 1) {
                $appearsValid = false;
            }
        }

        return $appearsValid;
    }
95875
public function validateLuhn($input)
    {
        $checksum = '';
        foreach (str_split(strrev($input)) as $i => $d) {
            $checksum .= ($i %2 !== 0) ? ($d * 2) : $d;
        }
        return array_sum(str_split($checksum)) % 10 === 0;
    }
27467
public function validate($input) {
        if (is_integer($input)) {
            return $this->validateMax($input) && $this->validateMin($input);
        }
        return $input == intval($input) && $this->validateMax($input) && $this->validateMin($input);
    }
730268
public function check($input)
    {
        $this->lastValue = $input;
        $anyFailed = false;
        foreach ($this->rules as $ruleName => &$rule) {

            // at least OK
            if ($rule->check($input)) {

                // stop here if any is OK or rule is sufficient
                if ($this->matchAny || $rule->isSufficient()) {
                    return true;
                }
            }

            // if not in match any mode -> first fail stops
            elseif (!$this->matchAny) {
                $this->failedRule = &$rule;
                return false;
            }

            // at least one failed
            else {
                if (!$anyFailed) {
                    $this->failedRule = &$rule;
                }
                $anyFailed = true;
            }
        }

        // all have to work out!
        return !$anyFailed;
    }
130163
public function validateRegexp(string $input): bool
    {
        $output = true;
        set_error_handler(function (int $severity, string $message) use (&$output) {
            if (strpos($message, 'preg_replace(): ') === 0) {
                $output = false;
            } else {
                return false;
            }
        }, E_WARNING | E_DEPRECATED);
        preg_replace($input, '', '');
        restore_error_handler();
        return $output
            ? preg_match("/^\\/[^\\p{C}\\p{Z}\\p{M}A-Zァ-ヶ\u{10000}-\u{10FFFD}]+\\/$/u", $input) === 1
            : false;
    }
684456
public function check($input)
    {
        if ($this->lazy) {
            $this->lazy = false;
            $this->parseDefinition();
        }
        $this->lastValue = $input;
        if (strlen($input) === 0 && $this->skipEmpty) {
            return true;
        }
        $constraint = $this->constraint;
        return $constraint($input, $this, $this->attrib, $this->dataFilter);
    }