private function matchStripHostsPatterns($url)
    {
        if (Filesystem::isLocalPath($url)) {
            return true;
        }

        if (is_array($this->stripHosts)) {
            $url = trim(parse_url($url, PHP_URL_HOST), '[]');

            if (false !== filter_var($url, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                $urltype = 'ipv4';
            } elseif (false !== filter_var($url, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                $urltype = 'ipv6';
            } else {
                $urltype = 'name';
            }

            if ('ipv4' === $urltype || 'ipv6' === $urltype) {
                $urlunpack = unpack('N*', @inet_pton($url));
            }

            foreach ($this->stripHosts as $pattern) {
                @list($type, $host, $mask) = $pattern;

                if ('/local' === $type) {
                    if ('name' === $urltype && 'localhost' === strtolower($url)
                        || ('ipv4' === $urltype || 'ipv6' === $urltype)
                        && false === filter_var($url, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE)
                    ) {
                        return true;
                    }
                } elseif ('/private' === $type) {
                    if (('ipv4' === $urltype || 'ipv6' === $urltype)
                        && false === filter_var($url, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)
                    ) {
                        return true;
                    }
                } elseif ('ipv4' === $type || 'ipv6' === $type) {
                    if ($urltype === $type && $this->matchAddr($urlunpack, $host, $mask)) {
                        return true;
                    }
                } elseif ('name' === $type) {
                    if ('name' === $urltype && preg_match($host, $url)) {
                        return true;
                    }
                }
            }
        }
    }