for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the BazingaGeocoderBundle package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Bazinga\GeocoderBundle\ProviderFactory;
use Geocoder\Provider\Here\Here;
use Geocoder\Provider\Provider;
use Http\Discovery\HttpClientDiscovery;
use Symfony\Component\OptionsResolver\OptionsResolver;
final class HereFactory extends AbstractFactory
{
protected static $dependencies = [
['requiredClass' => Here::class, 'packageName' => 'geocoder-php/here-provider'],
];
protected function getProvider(array $config): Provider
$httplug = $config['httplug_client'] ?: HttpClientDiscovery::find();
return new Here($httplug, $config['app_id'], $config['app_code'], $config['use_cit']);
}
protected static function configureOptionResolver(OptionsResolver $resolver)
$resolver->setDefaults([
'httplug_client' => null,
'use_cit' => false,
]);
$resolver->setAllowedTypes('httplug_client', ['object', 'null']);
$resolver->setAllowedTypes('use_cit', ['bool', 'false']);
$resolver->setRequired(['app_id', 'app_code']);