code: public function getCountryInfo(string $country = null, string $locale = null): array
      {
          $url = sprintf(self::BASE_ENDPOINT_URL, 'countryInfoJSON', $this->username);
  
          if (isset($country)) {
              $url = sprintf('%s&country=%s', $url, $country);
          }
  
          $url = sprintf('%s&style=FULL', $url);
  
          if (null !== $locale) {
              // Locale code transformation: for example from it_IT to it
              $url = sprintf('%s&lang=%s', $url, substr($locale, 0, 2));
          }
  
          $content = $this->getUrlContents($url);
          if (null === $json = json_decode($content)) {
              throw InvalidServerResponse::create($url);
          }
  
          if (!isset($json->geonames)) {
              return [];
          }
  
          $data = $json->geonames;
  
          if (empty($data)) {
              return [];
          }
  
          $results = [];
  
          foreach ($data as $item) {
              $countryInfo = new CountryInfo();
  
              $results[] = $countryInfo
                  ->setBounds($item->south, $item->west, $item->north, $item->east)
                  ->withContinent($item->continent ?? null)
                  ->withCapital($item->capital ?? null)
                  ->withLanguages($item->langesuages ?? '')
                  ->withGeonameId($item->geonameId ?? null)
                  ->withIsoAlpha3($item->isoAlpha3 ?? null)
                  ->withFipsCode($item->fipsCode ?? null)
                  ->withPopulation($item->population ?? null)
                  ->withIsoNumeric($item->isoNumeric ?? null)
                  ->withAreaInSqKm($item->areaInSqKm ?? null)
                  ->withCountryCode($item->countryCode ?? null)
                  ->withCountryName($item->countryName ?? null)
                  ->withContinentName($item->continentName ?? null)
                  ->withCurrencyCode($item->currencyCode ?? null);
          }
  
          return $results;
      }
docs: @param string|null $country
  @param string|null $locale
  
  @return array
  
  @throws \Geocoder\Exception\Exception