Check if it matches the file hash.

@since 1.1.5

@param string $url  → external url
@param string $path → internal file path

@return bool
771202
protected static function isModifiedHash($url, $path)
    {
        if (self::isExternalUrl($url)) {
            if (sha1_file($url) !== sha1_file($path)) {
                return self::$changes = true;
            }
        }

        return false;
    }
1050780
protected function verifyPath($path){
		if (file_exists($path)) return true;
			
		if (mkdir($path, 0777, true)) return true;
				
		return false;
	}
1032123
protected function isLocalPath(string $path): bool
    {
        if (Str::startsWith($path, ['https://', 'http://', '//'])) {
            return false;
        }

        return \filter_var($path, FILTER_VALIDATE_URL) === false;
    }
564458
public function has(string $path): bool
    {
        $keys = $this->explode($path);
        $array = $this->items;
        foreach ($keys as $key) {
            if (!array_key_exists($key, $array)) {
                return false;
            }
            $array = $array[$key];
        }
        return true;
    }
943022
protected function matches(Route $route, string $path): bool
	{
		if(preg_match($route->getRegex(), $path, $parameters) > 0)
		{
			$filtered = [];

			foreach($parameters as $key => $value)
			{
				if(is_string($key))
				{
					$filtered[$key] = $value;
				}
			}

			$route->setParameters($filtered);

			return true;
		}

		return false;
	}
205593
private function searchExtensions($path)
    {
        foreach ($this->fileExtensions as $ext) {
            if (file_exists($path . $ext)) {
                return $path . $ext;
            }
        }

        return false;
    }
249184
protected function _matchRelative($url) {
        $relative = $this->_relative();
        if (!$relative) {
            return true;
        }
        $components = parse_url($url);
        if (!isset($components['host'])) {
            return true;
        }
        $path = trim($components['path'], '/');
        return strpos($path, $relative) === 0;
    }
596448
public static function isInternal($url)
    {
        $relative = static::makeRelative($url);

        if (substr($relative, 0, 1) !== '/') {
            return false;
        }

        $path = static::getInternalPath($relative);

        return !URLFacade::isAvailable($path);
    }
927337
public function matchesPath($path)
    {
        if ($this->_data['path'] === '/' || $this->_data['path'] === $path) {
            return true;
        }

        if (strpos($path, $this->_data['path']) !== 0) {
            return false;
        }

        if (substr($this->_data['path'], -1, 1) === '/') {
            return true;
        }

        return substr($path, strlen($this->_data['path']), 1) === '/';
    }
1158938
public static function is_external_url($url)
    {
        if (\parse_url($url, PHP_URL_HOST) === Request::get_host()) {
            return false;
        }

        if (\strpos($url, "/") === 0) {
            return false;
        }

        return true;
    }
1179252
public function matchesPath($path)
    {
        // RFC6265 http://tools.ietf.org/search/rfc6265#section-5.1.4
        // A request-path path-matches a given cookie-path if at least one of
        // the following conditions holds:

        // o  The cookie-path and the request-path are identical.
        if ($path == $this->getPath()) {
            return true;
        }

        $pos = stripos($path, $this->getPath());
        if ($pos === 0) {
            // o  The cookie-path is a prefix of the request-path, and the last
            // character of the cookie-path is %x2F ("/").
            if (substr($this->getPath(), -1, 1) === "/") {
                return true;
            }

            // o  The cookie-path is a prefix of the request-path, and the first
            // character of the request-path that is not included in the cookie-
            // path is a %x2F ("/") character.
            if (substr($path, strlen($this->getPath()), 1) === "/") {
                return true;
            }
        }

        return false;
    }
60244
private static function isValidUriPath(string $path): bool
    {
        // http://tools.ietf.org/html/rfc3986#section-3
        // The scheme and path components are required, though the path may be
        // empty (no characters)
        if ($path === '') {
            return true;
        }

        // path          = path-abempty    ; begins with "/" or is empty
        //               / path-absolute   ; begins with "/" but not "//"
        //               / path-noscheme   ; begins with a non-colon segment
        //               / path-rootless   ; begins with a segment
        //               / path-empty      ; zero characters
        //
        // path-abempty  = *( "/" segment )
        // path-absolute = "/" [ segment-nz *( "/" segment ) ]
        // path-noscheme = segment-nz-nc *( "/" segment )
        // path-rootless = segment-nz *( "/" segment )
        // path-empty    = 0<pchar>
        // segment       = *pchar
        // segment-nz    = 1*pchar
        // segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
        //               ; non-zero-length segment without any colon ":"
        // pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:(?:[%s%s:@]|(?:%s))*\/?)*\z/i',
            'a-z0-9\-._~',
            '!$&\'()*+,;=',
            '%[a-f0-9]{2}'
        );

        return !!preg_match($pattern, $path);
    }
110855
protected function exists($url)
    {
        $shortener = Shortener::where('hash', hash('sha512', $url))->first();

        if (is_null($shortener)) {
            return false;
        }

        return route('shortener.show', [
            'url' => $this->hashids->encode($shortener->getKey()),
        ]);
    }
319279
protected function isDirectory($path)
    {
        $location = $this->applyPathPrefix($path);

        if (empty($location)) {
            return true;
        }

        try {
            $file = $this->share->stat($location);
        } catch (NotFoundException $e) {
            return false;
        }

        return $file->isDirectory();
    }
488353
public static function isAbsolute($path)
    {
        if (empty($path)) {
            return false;
        }

        return $path[0] === '/' ||
            preg_match('/^[A-Z]:\\\\/i', $path) ||
            substr($path, 0, 2) === '\\\\' ||
            self::isRegisteredStreamWrapper($path);
    }
1085159
public function verify($url)
    {
        $url = parse_url($url);
        if ($url === false) {
            throw new \Exception('Bad url to match (not an url ?)');
        }

        $path = isset($url['path']) ? $url['path'] : '';

        if ((bool) preg_match($this->pattern, $path, $matches)) {
            array_shift($matches);

            foreach ($matches as $position => $value) {
                $this->parameterCollection->getByPosition($position)
                    ->setValue($value);
            }

            return true;
        }

        return false;
    }
1341152
public function match($url)
    {
        if (!$this->schemes) {
            return true;
        }

        foreach ($this->schemes as $scheme) {
            if ($scheme->match($url)) {
                return true;
            }
        }

        return false;
    }