Check if a hash string is valid for the current adapter.

@since 2.1.0
@param string $input
Hash string to verify.
@return boolean
Returns true if the input string is a valid hash value, false
otherwise.
331650
public function verifyHash($input)
    {
        $salt = substr($input, 0, strrpos($input, '$') + 1);
        $checksum = substr($input, strrpos($input, '$') + 1);

        return ($this->verifySalt($salt) && 1 === preg_match('/^[\.\/0-9A-Za-z]{28}$/', $checksum));
    }
308345
public function validate($input): bool
    {
        $this->error = null; // clean
        foreach ($this->rules as $rule) {
            if (!$rule->validate($input)) {
                // apply custom description or use description from rule
                $this->setError($this->description ?? $rule->getDescription());
                return false;
            }
        }
        return true;
    }
820945
private function _validate($input) {
    // has to be something we can calculate
    if ( !is_string($input) && !is_numeric($input) ) {
      throw new \Exception("Input must be an equation or a number.");
    }

    // no empty inputs
    if ( trim($input) === '' ) {
      throw new \Exception("Input can't be blank.");
    }

    // validate the input format
    if ( !preg_match("/^[\(\s]*(([1-9][0-9]*d[1-9][0-9]*)|\d+)[\s\)]*(\s*([\-\+\*\/])[\s\(]*(([1-9][0-9]*d[1-9][0-9]*)|\d+)\)*)*$/i", $input) ) {
      throw new \Exception("Invalid equation.");
    }

    // make sure the parens are balanced
    if ( !$this->_is_balanced($input) ) {
      throw new \Exception("Unbalanced parens.");
    }

    $this->input = $input;
  }
80886
public function validate($input): bool
    {
        if (\is_string($input) && filter_var($input, FILTER_VALIDATE_EMAIL)) {
            [, $domain] = explode('@', $input, 2);
            if ($this->checkDns) {
                return checkdnsrr($domain, 'MX') || checkdnsrr($domain, 'A');
            }
            return true;
        }
        return false;
    }
1227885
protected function collectionIsIterable($input)
    {
        if (isset($input) && is_array($input)) {
            return true;
        }

        if ($input instanceof \ArrayAccess || $input instanceof \Iterator || $input instanceof \Traversable) {
            return true;
        }

        return false;
    }
299538
public function match($input)
    {
       
        $noMatch = true;
        foreach ($this->matchers as $matcher) {
            if ($matcher->noMatch()) {
                continue;
            }
            if ($matcher->match($input)) {
                $noMatch = false;
            }
            if ($matcher->matchFound()) {
                $this->matched[] = $matcher->matched;
                $this->resetMatchers();
                break;
            }
        }
        if ($noMatch) {
            return false;
        }
        return true;
    }
87701
public function validate($input) {
        if (is_null($input)) {
            return false;
        }
        if (is_string($input)) {
            return trim($input) !== '';
        }
        if (!is_array($input)) {
            return true;
        }
        foreach ($input as $item) {
            if ($this->validate($item)) {
                return true;
            }
        }
        return false;
    }
171188
public function validate(string $input, bool $caseSensitive): bool
    {
        $code = $this->getVerifyCode();
        $valid = $caseSensitive ? ($input === $code) : strcasecmp($input, $code) === 0;
        $session = $this->getApp()->getSession();
        $session->open();
        $name = $this->getSessionKey() . 'count';
        $session[$name] += 1;
        if ($valid || $session[$name] > $this->testLimit && $this->testLimit > 0) {
            $this->getVerifyCode(true);
        }

        return $valid;
    }
442934
public static function isBase64Encoded($input)
    {
        if ($input && @base64_encode(@base64_decode($input, true)) === $input) {
            return true;
        }

        return false;
    }
109324
public function validate($input): bool
    {
        // for array
        if (\is_array($input)) {
            return \in_array($this->containsValue, $input, false);
        }
        // for string
        if (\is_string($input)) {
            return false !== mb_stripos($input, $this->containsValue, 0, mb_detect_encoding($input));
        }
        // can't compare
        return false;
    }
495778
public static function isValidPasswordString($input)
    {
        if (!SettingsPiwik::isUserCredentialsSanityCheckEnabled()
            && !empty($input)
        ) {
            return true;
        }

        $l = strlen($input);

        return $l >= self::PASSWORD_MIN_LENGTH;
    }
168593
public static function verifyHash(string $hash, string $text, string $format = null): bool
    {
        return \hash_equals($hash, self::hash($text, $format));
    }
12293
public function validate( $input )
    {
        // Check if we received a unix timestamp, in this case we can just
        // directly convert and return it.
        if ( is_numeric( $input ) )
        {
            $date = new DateTime( '@' . $input );
        }
        // Otherwise we received most presumably some phpillowrary string, which
        // we first just try to parse with datetime (strtotime).
        else if ( ( $date = new DateTime( $input ) ) !== false )
        {
            // Already converted
        }
        // If IndexableDateTime could not parse the string, we got a problem. Maybe
        // handle more datetime formats here manually, but now we just fail.
        //
        // Since PHP 5.3 datetime seems to accept everything and just returns
        // NOW, if it fails to parse. So this seems untestable for now.
        else {
            throw new phpillowValidationException( 
                'Error parsing the date: %date', 
                array(
                    'date' => $input,
                )
            );
        }

        // Convert date to an array of ints, which is easily indexable inside
        // CouchDB views.
        return array(
            (int) $date->format( 'Y' ),
            (int) $date->format( 'm' ),
            (int) $date->format( 'd' ),
            (int) $date->format( 'H' ),
            (int) $date->format( 'i' ),
            (int) $date->format( 's' ),
        );
    }
38074
public function verifySalt($input)
    {
        $appearsValid = (1 === preg_match('/^\$2[axy]{1}\$\d{2}\$[\.\/0-9A-Za-z]{22}$/', $input));
        if ($appearsValid) {
            $costFactor = (int) substr($input, 4, 2);
            if ($costFactor < 4 || $costFactor > 31) {
                $appearsValid = false;
            }
        }

        return $appearsValid;
    }
347483
public static function isIp($input = false) {

        if ($input && !filter_var($input, FILTER_VALIDATE_IP) === false) {

            return true;
        }

        return false;
    }
317947
@Override
    public boolean isValid(Object input) {
        String str = input.toString();
        int len = str.length();
        if (minLength != null && len < minLength)
            return false;
        if (maxLength != null && len > maxLength)
            return false;

        return regex == null || str.matches(regex);
    }
683303
protected function validateDomainInput(InputInterface $input)
    {
        $this->domainName = $input->getArgument('name');
        if (!$this->validDomain($this->domainName)) {
            $this->stdErr->writeln("You must specify a <error>valid domain name</error>");

            return false;
        }

        $certPath = $input->getOption('cert');
        $keyPath = $input->getOption('key');
        $chainPaths = $input->getOption('chain');
        if ($certPath || $keyPath || $chainPaths) {
            if (!isset($certPath, $keyPath)) {
                $this->stdErr->writeln("Both the --cert and the --key are required for SSL certificates");
                return false;
            }
            try {
                $this->sslOptions = (new SslUtil())->validate($certPath, $keyPath, $chainPaths);
            } catch (\InvalidArgumentException $e) {
                $this->stdErr->writeln($e->getMessage());
                return false;
            }

            return true;
        }

        return true;
    }