@param string $url

@return AddressCollection
185239
private function executeQuery(string $url): AddressCollection
    {
        $content = $this->getUrlContents($url);
        $json = json_decode($content, true);

        if (isset($json['error'])) {
            switch ($json['error']['code']) {
                case static::CODE_BAD_IP:
                    throw new InvalidArgument('The API call should include a valid IP address.');
                case static::CODE_BAD_KEY:
                    throw new InvalidCredentials('The API call should include a API key parameter.');
                case static::CODE_NOT_AUTHORIZED:
                    throw new InvalidCredentials('The API key associated with your request was not recognized.');
                case static::CODE_ACCOUNT_INACTIVE:
                    throw new InvalidCredentials('The API key has not been approved or has been disabled.');
                case static::CODE_LIMIT_EXCEEDED:
                    throw new QuotaExceeded('The service you have requested is over capacity.');
                default:
                    throw new InvalidServerResponse(sprintf(
                        'GeoIPs error %s%s%s%s - query: %s',
                        $json['error']['code'],
                        isset($json['error']['status']) ? ', '.$json['error']['status'] : '',
                        isset($json['error']['message']) ? ', '.$json['error']['message'] : '',
                        isset($json['error']['notes']) ? ', '.$json['error']['notes'] : '',
                        $url
                    ));
            }
        }

        if (!is_array($json) || empty($json) || empty($json['response']) || empty($json['response']['code'])) {
            throw InvalidServerResponse::create($url);
        }

        $response = $json['response'];

        // Check response code
        switch ($response['code']) {
            case static::CODE_SUCCESS:
                // everything is ok
                break;
            case static::CODE_NOT_FOUND:
                return new AddressCollection([]);
            default:
                throw new InvalidServerResponse(sprintf(
                    'The GeoIPs API returned unknown result code "%s" for query: "%s".',
                    $response['code'],
                    $url
                ));
        }

        // Make sure that we do have proper result array
        if (empty($response['location']) || !is_array($response['location'])) {
            return new AddressCollection([]);
        }

        $location = array_map(function ($value) {
            return '' === $value ? null : $value;
        }, $response['location']);

        $adminLevels = [];

        if (null !== $location['region_name'] || null !== $location['region_code']) {
            $adminLevels[] = [
                'name' => $location['region_name'],
                'code' => $location['region_code'],
                'level' => 1,
            ];
        }

        if (null !== $location['county_name']) {
            $adminLevels[] = [
                'name' => $location['county_name'],
                'level' => 2,
            ];
        }

        $results = Address::createFromArray([
            'providedBy' => $this->getName(),
            'country' => $location['country_name'],
            'countryCode' => $location['country_code'],
            'adminLevels' => $adminLevels,
            'locality' => $location['city_name'],
            'latitude' => $location['latitude'],
            'longitude' => $location['longitude'],
            'timezone' => $location['timezone'],
        ]);

        return new AddressCollection([$results]);
    }
1226215
public function getUriArguments($url): array
    {
        $uriParam = str_replace($url, '', $this->router->getCurrentUri());

        return array_filter(explode('/', $uriParam));
    }
101829
public function getSitemap(string $url)
    {
        return collect($this->tags)->first(function (Tag $tag) use ($url) {
            return $tag->getType() === 'sitemap' && $tag->url === $url;
        });
    }
300209
public function setUrl($url)
    {
        if (strpos($url, '/') !== 0) {
            $url = '/' . $url;
        }
        $this->url = $url;
        return $this;
    }
589116
public function getEndpointForUrl($url)
    {
        if (!isset($this->cachedEndpoints[$url])) {
            $this->cachedEndpoints[$url] = $this->fetchEndpointForUrl($url);
        }

        return $this->cachedEndpoints[$url];
    }
854241
public function url($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
            return $url;
        }

        if (is_string($url)) {
            return $this->parseStringUrl($url);
        }

        if (is_array($url)) {
            return $this->make(new UrlSettings($url));
        }

        if ($url instanceof UrlSettings) {
            return $this->make($url);
        }

        throw new \InvalidArgumentException('Settings is not a supported type');
    }
106624
public static function url($url) {
		if (
			is_array($url)
			|| (is_string($url) && (preg_match('@^' . implode('|', Common::$uriSchemes) . ':@i', $url) || preg_match('@^#@i', $url)))
		) {
			return $url;
		}

		// Reset current language that gets changed by `I18n.I18nRoute::parse()`.
		$reset = Configure::check('Config.language') && $lang = Configure::read('Config.language');
		$parsed = Router::parse($url);
		if ($reset) Configure::write('Config.language', $lang);

		if ($parsed === false) {
			return $url;
		}

		if (!empty($parsed['pass'])) {
			$parsed = array_merge($parsed, $parsed['pass']);
			unset($parsed['pass']);
		}

		if (!empty($parsed['named'])) {
			foreach ($parsed['named'] as $param => $val) {
				$parsed[$param] = $val;
			}
			unset($parsed['named']);
		}

		if (array_key_exists('lang', $parsed) && strpos($url, $parsed['lang']) !== 1) {
			unset($parsed['lang']);
		}

		return $parsed;
	}
1132611
public function locate($url)
    {
        if(!isset($this->_locations[$url]))
        {
            $info = array(
                'url'   => $url,
                'path'  => '',
            );

            $this->_locations[$url] = $this->find($info);
        }

        return $this->_locations[$url];
    }
219243
public function url(string $url) : self
    {
        $this->route = $url;

        $this->active($url);

        return $this;
    }
756301
public function setUrl(string $url) : Request
    {
        $components = parse_url($url);

        if ($components === false) {
            throw new \InvalidArgumentException('The URL provided is not valid.');
        }

        if (! isset($components['scheme'])) {
            throw new \InvalidArgumentException('The URL must have a scheme.');
        }

        $scheme = strtolower($components['scheme']);

        if ($scheme !== 'http' && $scheme !== 'https') {
            throw new \InvalidArgumentException(sprintf('The URL scheme "%s" is not acceptable.', $scheme));
        }

        $isSecure = ($scheme === 'https');

        if (! isset($components['host'])) {
            throw new \InvalidArgumentException('The URL must have a host name.');
        }

        $host = $components['host'];

        if (isset($components['port'])) {
            $port = $components['port'];
            $hostHeader = $host . ':' . $port;
        } else {
            $port = ($isSecure ? 443 : 80);
            $hostHeader = $host;
        }

        $this->path = isset($components['path']) ? $components['path'] : '/';
        $requestUri = $this->path;

        if (isset($components['query'])) {
            $this->queryString = $components['query'];
            parse_str($this->queryString, $this->query);
            $requestUri .= '?' . $this->queryString;
        } else {
            $this->queryString = '';
            $this->query = [];
        }

        $this->setHeader('Host', $hostHeader);

        $this->host = $host;
        $this->port = $port;
        $this->isSecure = $isSecure;
        $this->requestUri = $requestUri;

        return $this;
    }
610154
public function camo($url)
    {
        return $this->formatter->formatCamoUrl(
            $this->domain,
            $this->getDigest($url),
            $url
        );
    }
832955
public function url($url, $parameters = [])
    {
        $this->url = $url;
        $this->parameters = $parameters;

        return $this;
    }
20084
public static function base($url) {
        if (preg_match('#^(/|(ht|f)tps?://).+#', $url)) {
            return $url;
        }
        $url = preg_replace('#/?index\.html?$#', '', $url);

        return WWWROOT_DIR . $url;
    }
204537
public function dir_from_url($url){
    $dir = false;
    foreach ( $this->dirs() as $i => $d ){
      if ( (strpos($url, $i) === 0) &&
        (\strlen($i) > \strlen($dir) )
      ){
        $dir = $i;
        break;
      }
    }
    return $dir;
  }
397872
public static function fromString($url)
    {
        static $defaults = ['scheme' => null, 'host' => null,
            'path' => null, 'port' => null, 'query' => null,
            'user' => null, 'pass' => null, 'fragment' => null];

        if (false === ($parts = parse_url($url))) {
            throw new \InvalidArgumentException('Unable to parse malformed '
                . 'url: ' . $url);
        }

        $parts += $defaults;

        // Convert the query string into a Query object
        if ($parts['query'] || 0 !== strlen($parts['query'])) {
            $parts['query'] = Query::fromString($parts['query']);
        }

        return new static($parts['scheme'], $parts['host'], $parts['user'],
            $parts['pass'], $parts['port'], $parts['path'], $parts['query'],
            $parts['fragment']);
    }
1159325
public function url( string$url ):self
	{
		$url= parse_url($url);

		if( !is_array($url) )
			throw new \Exception("Url '$url' is invalid.");

		foreach( $url as $key=>$value )
		{
			$this->$key= $value;
		}

		return $this;
	}
496668
public function setUrl($url)
    {
        $this->url = $url;

        // Check if the url ends with a slash
        if ($this->url && substr($this->url, -1) !== '/') {
            $this->url .= '/';
        }

        return $this;
    }