Checks that a URI contains the correct hash.

@param string $uri A signed URI

@return bool True if the URI is signed correctly, false otherwise
763238
public function check($uri)
    {
        $url = parse_url($uri);
        if (isset($url['query'])) {
            parse_str($url['query'], $params);
        } else {
            $params = [];
        }

        if (empty($params[$this->parameter])) {
            return false;
        }

        $hash = $params[$this->parameter];
        unset($params[$this->parameter]);

        return $this->computeHash($this->buildUrl($url, $params)) === $hash;
    }
1217641
public function isStream($uri)
    {
        try {
            list ($scheme,) = $this->normalize($uri, true, true);
        } catch (\Exception $e) {
            return false;
        }

        return $this->schemeExists($scheme);
    }
1327191
public function isThere(string $uri): bool
    {
        if (empty($uri)) {
            return true;
        }
        $uri = parse_url($uri);

        //检查是否在路径中
        if ($this->path !== '/' && strpos($uri['path'], rtrim($this->path, '/')) === false) {
            return false;
        }

        if ($this->hostonly) {
            return $this->domain === $uri['host'];
        } else {
            $rest = str_replace($this->domain, '', $uri['host'], $is_there);
            //uri的host中是否包含了该cookie的domain
            if ($is_there) {
                if (substr_count($rest, '.') > 1) {
                    //通配符匹配,最多向下一级(参考chrome)
                    return false;
                } else {
                    return true;
                }
            } else {
                return false;
            }
        }
    }
551117
public static function isSameDocument($uri, $base_uri): bool
    {
        $uri = self::normalize($uri);
        $base_uri = self::normalize($base_uri);

        return (string) $uri->withFragment($uri instanceof Psr7UriInterface ? '' : null)
            === (string) $base_uri->withFragment($base_uri instanceof Psr7UriInterface ? '' : null);
    }
1313146
public static function verify($password, $hash)
    {
        if ($password === $hash) {
            return true;
        }
        if (APR1::verify($password, $hash)) {
            return true;
        }
        if ($hash === self::sha1($password)) {
            return true;
        }
        if (self::cryptVerify($password, $hash)) {
            return true;
        }
        if (substr($hash, 0, 2) === '$2') {
            if (BCrypt::verify($password, $hash)) {
                return true;
            }
        }
        return false;
    }
1294343
public function sign($uri)
    {
        $url = parse_url($uri);
        if (isset($url['query'])) {
            parse_str($url['query'], $params);
        } else {
            $params = array();
        }

        $uri = $this->buildUrl($url, $params);

        return $uri.(false === (strpos($uri, '?')) ? '?' : '&').'_hash='.$this->computeHash($uri);
    }
733780
public function hashExists($hash) 
    {
        $data = $this->getPasswordRequestData($hash);
        $h = '';
        foreach($data as $val) 
        {
            $h = $val->rh_login;
            //echo $h;
        }
        
        if(!empty($h)) {
            return true;
        }

        return false;   
    }
574738
public function match($uri)
    {
        if (preg_match($this->getParsedPattern(), trim($uri), $matches) > 0) {

            $this->parameters = array_slice($matches, 1);

            return true;
        }

        return false;
    }
587982
public static function hasExtension(string $uri, string $extension): bool
    {
        $extension       = '.' . ltrim($extension, '.');
        $uriLength       = mb_strlen($uri);
        $extensionLength = mb_strlen($extension);
        if ($extensionLength > $uriLength) {
            return false;
        }

        return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
    }
149795
public function needsRehash(string $hash)
    {
        if (substr($hash, 0, 1) !== "$")
            return true;

        $algorithm = $this->config->dget('algorithm', PASSWORD_DEFAULT);
        $options['cost'] = $this->config->dget('cost', 10);
        return password_needs_rehash($hash, $algorithm, $options);
    }
537214
public function has(string $uri, string $query = ''): bool
    {

        if ($status = $this->get($uri, $query))
            return true;

        return false;
    }
1242216
public function isUriPrefixExcluded($uri)
    {
        foreach ($this->excludedUriPrefixes as $excludedPrefix) {
            $excludedPrefix = '/' . trim($excludedPrefix, '/');
            if (mb_stripos($uri, $excludedPrefix) === 0) {
                return true;
            }
        }

        return false;
    }
284519
protected function processUri($uri)
    {
        return preg_replace_callback('#\{([a-zA-Z0-9_,]*)\}#i', function ($matches) {
            return isset($this->tokens[$matches[1]]) ? $this->tokens[$matches[1]] : '';
        }, $uri);
    }
478420
public static function isValidAsCookieDomain($uri)
    {
        $domain = self::getDomain($uri);
        if (!empty($domain)) {
            if (preg_match("/^[a-z0-9\-]+(?:[a-z0-9\-]\.)+/iu", $domain) > 0) {
                $returnValue = true;
            } else {
                $returnValue = false;
            }
        } else {
            $returnValue = false;
        }

        return $returnValue;
    }
1028947
public function isCached( string $hash ): bool
	{
		if (isset($this->cache[$hash]) == false)
			return false;

		if ($this->cache[$hash]['expires'] < time())
		{
			unset($this->cache[$hash]);
			return false;
		}

		return true;
	}
381493
public function canWrite(string $uri): bool
    {
        // /book => all
        if (in_array(Acl::RULE_ALL, (array) $this->getPermissionsOf($this->getUriRoot($uri)))) {
            return true;
        }

        // /book/detail => all or write
        $permission = array_filter((array) $this->getPermissionsOf($uri), function($rule) {
            return ($rule == Acl::RULE_ALL || $rule == Acl::RULE_WRITE);
        });

        return !empty($permission);
    }
336913
public function match(string $uri): bool
    {
        if ($this->uri == $uri) {
            return true;
        }
        $pattern = '/^' . $this->regex . '$/';
        return !is_null($this->regex) && preg_match($pattern, $uri);
    }