We do not support Country and City services because they do not return much fields.

@see http://dev.maxmind.com/geoip/web-services

@param string $service

@return string[]
497177
private function fieldsForService(string $service): array
    {
        switch ($service) {
            case self::CITY_EXTENDED_SERVICE:
                return [
                    'countryCode',
                    'regionCode',
                    'locality',
                    'postalCode',
                    'latitude',
                    'longitude',
                    'metroCode',
                    'areaCode',
                    'isp',
                    'organization',
                ];
            case self::OMNI_SERVICE:
                return [
                    'countryCode',
                    'countryName',
                    'regionCode',
                    'region',
                    'locality',
                    'latitude',
                    'longitude',
                    'metroCode',
                    'areaCode',
                    'timezone',
                    'continentCode',
                    'postalCode',
                    'isp',
                    'organization',
                    'domain',
                    'asNumber',
                    'netspeed',
                    'userType',
                    'accuracyRadius',
                    'countryConfidence',
                    'cityConfidence',
                    'regionConfidence',
                    'postalConfidence',
                    'error',
                ];
            default:
                throw new UnsupportedOperation(sprintf('Unknown MaxMind service %s', $service));
        }
    }
963653
public static function getServiceConditionals($value)
    {
        $services = array();

        if (is_array($value)) {
            foreach ($value as $v) {
                $services = array_unique(array_merge($services, self::getServiceConditionals($v)));
            }
        } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
            $services[] = (string) $value;
        }

        return $services;
    }
1212676
public function resolve(string $service): ResolveAllUrlsResponse
    {
        $key = $this->cacheKey($service);
        $item = $this->cache->getItem($key);

        if ($item->isHit()) {
            return $item->get();
        }

        $options = [
            'query' => [
                'schema' => self::SCHEMA_VERSION,
                '_service' => $service,
            ],
        ];

        $response = $this->authenticatedClient->request('GET', static::RESOLVE_ALL_URLS_URL, $options);

        $encoders = [new JsonEncoder()];
        $normalizers = [new UriNormalizer(), new ObjectNormalizer(null, null, null, new PhpDocExtractor()), new ArrayDenormalizer()];
        $serializer = new Serializer($normalizers, $encoders);

        /** @var ResolveAllUrlsResponse $resolved */
        $resolved = $serializer->deserialize($response->getBody(), ResolveAllUrlsResponse::class, 'json');
        $resolved->setService($service);
        $this->saveCache($key, $resolved);

        return $resolved;
    }
359503
public function services(string $service): array
    {
        if (empty($this->services[$service])) {
            $services = $this->all();
            if (empty($services[$service])) {
                throw new OutOfBoundsException("The service: {$service} not found");
            }

            $this->services[$service] = $services[$service];
            unset($services);
        }

        return $this->services[$service];
    }
733306
public function formAction($service)
    {
        $config = $this->oauthManager->getConfiguration($service);
        $form = $this->formFactory->create(OauthConfigurationType::class, $config, ['resource_owner' => $service]);

        return ['form' => $form->createView(), 'service' => $service];
    }
1365060
private function getKernelContainerService(string $service): object
    {
        /** @var \Symfony\Component\DependencyInjection\ServiceLocator $serviceLocator */
        $serviceLocator = $this->container->get('service_bus.public_services_locator');

        /** @var object $object */
        $object = $serviceLocator->get($service);

        return $object;
    }
887661
public function getConfig($service)
    {
        $baseConfig = array(
            'credentials' => $this->config['credentials'],
            'region' => $this->config['region'],
            'profile' => $this->config['profile'],
            'version' => 'latest',
        );

        if (!isset($this->config['services'][$service])) {
            return $baseConfig;
        }

        return array_merge($baseConfig, $this->config['services'][$service]);
    }
1294588
public function &getService($service)
    {

        $classServiceName = basename($service);
        if (isset($this->$classServiceName)) {
            return $this->$classServiceName;
        } else {
            $service = ucfirst($service);
            $factoryClass = $service . "Factory";

            if (class_exists($factoryClass)) {
                $factory = new $factoryClass();
                if ($factory instanceof ServiceFactory) {
                    if (!$this->isUnderConstruction($service)) {
                        $this->underConstruction($service);
                        $newService = $factory->create();
                        $this->constructed($service);
                    } else {
                        if(isset($this->proxyObjects[$classServiceName])) {
                            return $this->proxyObjects[$classServiceName];
                        }else{
                            return $this->$classServiceName;
                        }
                    }

                    $this->$classServiceName = $newService;
                    return $newService;
                }
            }

            if (!$this->isUnderConstruction($service)) {
                $this->underConstruction($service);
                $object = new $service();
                if ($object instanceof ServiceFactory) {
                    $newService = $object->create();
                } else {
                    $newService = $object;
                }
                $this->constructed($service);
            } else {
                if(isset($this->proxyObjects[$classServiceName])) {
                    return $this->proxyObjects[$classServiceName];
                }else{
                    return $this->$classServiceName;
                }
            }

            $this->$classServiceName = $newService;
            return $newService;
        }
    }
907030
public function getServiceProfile($service)
    {
        if (isset($this->serviceProfiles[$service])) {
            return $this->serviceProfiles[$service];
        }

        return null;
    }
985059
public function getlocation($ip = '')
    {
        $obj = new Ip2Region();
        $res = $obj->btreeSearch($ip);
        $res = explode('|', $res['region']);
        return [
            'ip' => $ip,
            'country' => $res[2].$res[3],
            'area' => $res[4]
        ];
    }
705319
private function getIso3166Countries(): array
    {
        $countries = $this->country_service->getAllCountries();

        // Get the country names for each language
        $country_to_iso3166 = [];

        foreach (I18N::activeLocales() as $locale) {
            I18N::init($locale->languageTag());

            foreach ($this->country_service->iso3166() as $three => $two) {
                $country_to_iso3166[$three]             = $two;
                $country_to_iso3166[$countries[$three]] = $two;
            }
        }

        return $country_to_iso3166;
    }
225018
private function transform($location)
    {
        return [
            'iso_code'    => $location->iso_code,
            'country'     => $location->country,
            'city'        => $location->city,
            'state'       => $location->state,
            'state_code'  => $location->state_code,
            'postal_code' => $location->postal_code,
            'latitude'    => $location->latitude,
            'longitude'   => $location->longitude,
            'timezone'    => $location->timezone,
            'continent'   => $location->continent,
            'currency'    => $location->currency,
        ];
    }
598518
public function getListArgumentForService(callable $service)
    {
        if (is_array($service)) {
            reset($service);
            $serviceObject = current($service);
            $serviceMethod = next($service);
            return $this->getListArgumentForMethod($serviceObject, $serviceMethod);
        }

        $errMsg = 'Unsupported type callback';
        throw new Exception\UnsupportedServiceTypeException($errMsg);
    }
1202715
protected function urlService($service)
	{
		if($service instanceof Uri)
		{
			$uri = $service->get();
		}
		else
		{
			$uri = $service;
		}
		return $this->baseUrl .'/'. ltrim($uri, '/');
	}
401794
protected function clean(array $services = array())
    {
        if (empty($services)) {
            return array();
        }

        if (!empty($this->config['allow'])) {
            $allow = array_map('strtolower', (array) $this->config['allow']);
            $services = array_filter($services, function ($arr) use ($allow) {
                $serviceName = strtolower(basename(str_replace('\\', '/', get_class($arr))));
                return (in_array($serviceName, $allow));
            });
        }

        if (!empty($services) && !empty($this->config['deny'])) {
            $deny = array_map('strtolower', (array) $this->config['deny']);
            $services = array_filter($services, function ($arr) use ($deny) {
                $serviceName = strtolower(basename(str_replace('\\', '/', get_class($arr))));
                return (!in_array($serviceName, $deny));
            });
        }

        return (array) $services;
    }
195834
protected function getService($service) {
		$service = strtolower($service);
		$services = $this->getServices();
		if (!isset($services[$service])) {
			throw new EAuthException(Yii::t('eauth', 'Undefined service name: {service}.', array('{service}' => $service)), 500);
		}
		return $services[$service];
	}
1002032
private function serviceFactoryMap(array $providers): array
    {
        $wrap = function ($factory) { return [$factory]; };

        return array_reduce($providers, function ($factories, ServiceProviderInterface $provider) use ($wrap) {

            return array_merge($factories, array_map($wrap, $provider->getFactories()));

        }, []);
    }