@param string $url

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

        if (!is_array($json) || !count($json)) {
            throw InvalidServerResponse::create($url);
        }

        if (!array_key_exists('geoplugin_status', $json) || (200 !== $json['geoplugin_status'] && 206 !== $json['geoplugin_status'])) {
            return new AddressCollection([]);
        }

        // Return empty collection if address was not found
        if ('' === $json['geoplugin_regionName']
        && '' === $json['geoplugin_regionCode']
        && '' === $json['geoplugin_city']
        && '' === $json['geoplugin_countryName']
        && '' === $json['geoplugin_countryCode']
        && '0' === $json['geoplugin_latitude']
        && '0' === $json['geoplugin_longitude']) {
            return new AddressCollection([]);
        }

        $data = array_filter($json);

        $adminLevels = [];

        $region = \igorw\get_in($data, ['geoplugin_regionName']);
        $regionCode = \igorw\get_in($data, ['geoplugin_regionCode']);

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

        $results = [];
        $results[] = Address::createFromArray([
            'providedBy' => $this->getName(),
            'locality' => isset($data['geoplugin_city']) ? $data['geoplugin_city'] : null,
            'country' => isset($data['geoplugin_countryName']) ? $data['geoplugin_countryName'] : null,
            'countryCode' => isset($data['geoplugin_countryCode']) ? $data['geoplugin_countryCode'] : null,
            'adminLevels' => $adminLevels,
            'latitude' => isset($data['geoplugin_latitude']) ? $data['geoplugin_latitude'] : null,
            'longitude' => isset($data['geoplugin_longitude']) ? $data['geoplugin_longitude'] : null,
        ]);

        return new AddressCollection($results);
    }
610154
public function camo($url)
    {
        return $this->formatter->formatCamoUrl(
            $this->domain,
            $this->getDigest($url),
            $url
        );
    }
540478
protected function getUrlContents(string $url): string
    {
        $request = $this->getRequest($url);

        return $this->getParsedResponse($request);
    }
918811
public function get($url)
    {
        $url = new Url($url);
        $location = $this->branches->getUrlManager()->urlMatches($url);

        if ($location === false) {
            $resolution = new NotFoundResolution();
        } else {
            $url = $location->getUrl();
            $realPath = $location->getPath();

            if (Branches::isDirectoryValid($realPath)) {
                $post = $this->branches->getPostProvider()->provide($url, $realPath);
                $resolution = new PostResolution($post);
            } elseif (Branches::isFileValid($realPath)) {
                $file = $this->branches->getFileProvider()->provide($url, $realPath);
                $resolution = new FileResolution($file);
            } else {
                $resolution = new NotFoundResolution();
            }
        }

        $result = $this->branches->getResolutionManager()->resolve($this->branches->getResolutionManager()->filterResolution($url, $resolution));

        if (null === $result) {
            throw new NodeNotFoundException($url);
        }

        return $result;
    }
711379
public function withURL ($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) === false) {
            throw new InvalidArgumentException("invalid url `{$url}` given for news item");
        }

        $new = clone $this;
        $new->url = $url;

        return $new;
    }
1163499
private function setUrl(?string $url): self
    {
        $this->updatePropertyValue(
            UrlFieldInterface::PROP_URL,
            $url
        );

        return $this;
    }
725477
protected function _applySort($url)
    {
        if (!$this->_sortEnabled) {
            return $url;
        }

        if (!empty($this->request->getQuery('s'))) {
            $url['?']['s'] = $this->request->getQuery('s');
        }

        if (!empty($this->request->getQuery('d'))) {
            $url['?']['d'] = $this->request->getQuery('d');
        }

        return $url;
    }
1261403
public function parse($url)
    {
        $hostname = $this->extractHostname($url);

        // If received hostname is valid IP address, result will be formed from it.

        if (IP::isValid($hostname)) {
            return new $this->resultClassName(null, $hostname, null);
        }

        list($subDomain, $host, $suffix) = $this->extractParts($hostname);

        return new $this->resultClassName($subDomain, $host, $suffix);
    }
138951
public function setURL(URL $url)
    {
        $this->domain = $url->host;
        $this->path = $url->path;
        $this->secure = $url->secure;
        return $this;
    }
829119
protected function getUrlContents($url)
    {
        $client = $this->getGuzzleClient();

        return $client->get($url)->getBody()->getContents();
    }
950991
public function lookup($url)
  {
    $result = array();
    // get url's to check
    $canon_url = GoogleSafeBrowsing_Lookup_URL::googleCanonicalize($url);
    if(is_null($canon_url)){
      // unable to canonicalize, nothing we can do
      $this->debugLog('lookup('.$url.'): cannot canonicalize url, skipping');
      return $result;
    }
    $lookup_urls = GoogleSafeBrowsing_Lookup_URL::googleGetLookupExpressions($canon_url);
    
    $lookup_hashes = array();
    foreach($lookup_urls as $lookup_url){
      $lookup_hashes[]=GoogleSafeBrowsing_Lookup_URL::hash($lookup_url);
      //$this->debugLog(bin2hex($lookup_hashes[count($lookup_hashes)-1])." $lookup_url");
    }
    
    $found_hashes=$this->storage->hasPrefix($lookup_hashes);
    
    $matched_lists=array();
    // full hash lookups
    foreach($found_hashes as $found_hash){
      $this->debugLog('lookup('.$url.'): found hash prefix for '.bin2hex($found_hash));
      $lookup_result=$this->storage->isListedInCache($found_hash);
      if(is_null($lookup_result)){
        $lookup_result=array();
        // not cached, query google
        $collection=$this->api->getHash(substr($found_hash,0,4),$this->storage->getLists());
        if(count($collection->list_hashes)==0){
          // no hashes found, can happen, so insert dummy record for this prefix
          // so we can use the cached result (empty)
          $this->storage->addHashInCache($found_hash,$lookup_result,null,(int)$collection->cache);
        }else{
          // full length hashes found
          foreach($collection->list_hashes as $list_hash){
            $this->debugLog('lookup('.$url.'): remote lookup found full length hashes in list '.$list_hash->list_name);
            foreach($list_hash->hashes as $hash){
              $this->debugLog('lookup('.$url.'):   hash '.bin2hex($hash->hash));
              // cache in db
              $cache_seconds=(int)$collection->cache;
              if(isset($hash->cache) && $hash->cache){
                $cache_seconds=(int)$hash->cache;
              }
              $this->storage->addHashInCache($hash->hash,array($list_hash->list_name),$hash->raw_meta,$cache_seconds);
              if($hash->hash==$found_hash){
                // full length hash match
                if(!in_array($list_hash->list_name, $lookup_result)){
                  $lookup_result[]=$list_hash->list_name;
                }
              }
            }
          }
        }
      }// end cached if/else
      // $lookup_result is array of listnames (can be empty if not listed)
      foreach($lookup_result as $matched_list){
        $matched_lists[$matched_list]=true;
      }
    }
    if(count($matched_lists)>0){
      $this->debugLog('lookup('.$url.'): listed in '.implode(', ',array_keys($matched_lists)));
    }
    return array_keys($matched_lists);
  }
520434
public static function tumblr(Url $url)
    {
        if (($value = $url->getQueryParameter('z'))) {
            return Url::create($value);
        }

        return $url;
    }
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]);
    }
609136
private function executeGetQuery(string $endpoint, array $params): AddressCollection
    {
        $baseUrl = $this->getUrl($endpoint);
        $url = $this->addGetQuery($baseUrl, $params);

        $content = $this->getUrlContents($url);

        return $this->parseResponseContent($content);
    }
832955
public function url($url, $parameters = [])
    {
        $this->url = $url;
        $this->parameters = $parameters;

        return $this;
    }
669431
public function getExtReference($url)
    {
        $path = parse_url($url, PHP_URL_PATH);
        if ($path === false) {
            throw new \InvalidArgumentException(sprintf('URL %s', $url));
        }

        $id = null;
        $collection = null;

        if (!isset($this->resolvingCache[$path])) {
            foreach ($this->router->getRouteCollection()->all() as $route) {
                list($collection, $id) = $this->getDataFromRoute($route, $path);
                if ($collection !== null && $id !== null) {
                    $this->resolvingCache[$path] = $route;
                    return ExtReference::create($collection, $id);
                }
            }
        } else {
            list($collection, $id) = $this->getDataFromRoute($this->resolvingCache[$path], $path);
            return ExtReference::create($collection, $id);
        }

        throw new \InvalidArgumentException(sprintf('Could not read URL %s', $url));
    }
1369876
public function setUrl($url)
    {
        $this->currentUrl = $url;
        $this->misc->setUrl($url);

        return $this;
    }