ProviderFactory/BingMapsFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class BingMapsFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => BingMaps::class, 'packageName' => 'geocoder-php/bing-maps-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new BingMaps($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/FreeGeoIpFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class FreeGeoIpFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => FreeGeoIp::class, 'packageName' => 'geocoder-php/free-geoip-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new FreeGeoIp($httplug, $config['base_url']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
'base_url' => 'https://freegeoip.net/json/%s', |
38 |
|
]); |
39 |
|
|
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('base_url', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/GeoIPsFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class GeoIPsFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => GeoIPs::class, 'packageName' => 'geocoder-php/geoips-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new GeoIPs($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/GeonamesFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class GeonamesFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => Geonames::class, 'packageName' => 'geocoder-php/geonames-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new Geonames($httplug, $config['username']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('username'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('username', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/MapzenFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class MapzenFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => Mapzen::class, 'packageName' => 'geocoder-php/mapzen-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new Mapzen($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/MaxMindBinaryFactory.php 1 location
|
@@ 20-41 (lines=22) @@
|
17 |
|
use Geocoder\Provider\Provider; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class MaxMindBinaryFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => MaxMindBinary::class, 'packageName' => 'geocoder-php/maxmind-binary-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
return new MaxMindBinary($config['dat_file'], $config['open_flag']); |
29 |
|
} |
30 |
|
|
31 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
32 |
|
{ |
33 |
|
$resolver->setDefaults([ |
34 |
|
'open_flag' => null, |
35 |
|
]); |
36 |
|
|
37 |
|
$resolver->setRequired('dat_file'); |
38 |
|
$resolver->setAllowedTypes('dat_file', ['string']); |
39 |
|
$resolver->setAllowedTypes('open_flag', ['string', 'null']); |
40 |
|
} |
41 |
|
} |
42 |
|
|
ProviderFactory/OpenCageFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class OpenCageFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => OpenCage::class, 'packageName' => 'geocoder-php/open-cage-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new OpenCage($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/PickPointFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class PickPointFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => PickPoint::class, 'packageName' => 'geocoder-php/pickpoint-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new PickPoint($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/TomTomFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class TomTomFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => TomTom::class, 'packageName' => 'geocoder-php/tomtom-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new TomTom($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|
ProviderFactory/IpstackFactory.php 1 location
|
@@ 20-43 (lines=24) @@
|
17 |
|
use Http\Discovery\HttpClientDiscovery; |
18 |
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
19 |
|
|
20 |
|
final class IpstackFactory extends AbstractFactory |
21 |
|
{ |
22 |
|
protected static $dependencies = [ |
23 |
|
['requiredClass' => Ipstack::class, 'packageName' => 'geocoder-php/ipstack-provider'], |
24 |
|
]; |
25 |
|
|
26 |
|
protected function getProvider(array $config): Provider |
27 |
|
{ |
28 |
|
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find(); |
29 |
|
|
30 |
|
return new Ipstack($httplug, $config['api_key']); |
31 |
|
} |
32 |
|
|
33 |
|
protected static function configureOptionResolver(OptionsResolver $resolver) |
34 |
|
{ |
35 |
|
$resolver->setDefaults([ |
36 |
|
'httplug_client' => null, |
37 |
|
]); |
38 |
|
|
39 |
|
$resolver->setRequired('api_key'); |
40 |
|
$resolver->setAllowedTypes('httplug_client', ['object', 'null']); |
41 |
|
$resolver->setAllowedTypes('api_key', ['string']); |
42 |
|
} |
43 |
|
} |
44 |
|
|