Example #1
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $apiKey  An API key.
  * @param string               $service The specific Maxmind service to use (optional).
  * @param bool                 $useSsl  Whether to use an SSL connection (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey, $service = self::CITY_EXTENDED_SERVICE, $useSsl = false)
 {
     parent::__construct($adapter, null);
     $this->apiKey = $apiKey;
     $this->service = $service;
     $this->useSsl = $useSsl;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function __construct(HttpAdapterInterface $adapter, $locale = 'en')
 {
     if (false === $adapter instanceof GeoIP2Adapter) {
         throw new InvalidArgumentException('GeoIP2Adapter is needed in order to access the GeoIP2 service.');
     }
     parent::__construct($adapter, $locale);
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     if (!function_exists('geoip_record_by_name')) {
         throw new ExtensionNotLoaded('You must install the GeoIP extension, see: https://php.net/manual/book.geoip.php.');
     }
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $locale  A locale (optional).
  * @param string               $region  Region biasing (optional).
  * @param bool                 $useSsl  Whether to use an SSL connection (optional)
  * @param string               $apiKey  Google Geocoding API key (optional)
  */
 public function __construct(HttpAdapterInterface $adapter, $locale = null, $region = null, $useSsl = false, $apiKey = null)
 {
     parent::__construct($adapter, $locale);
     $this->region = $region;
     $this->useSsl = $useSsl;
     $this->apiKey = $apiKey;
 }
Example #5
0
 /**
  * Constructor.
  *
  * @param DoctrineCache $cache    The cache interface
  * @param Provider      $provider The fallback provider
  * @param int           $lifetime The cache lifetime
  * @param string        $locale
  */
 public function __construct(DoctrineCache $cache, Provider $provider, $lifetime = 0, $locale = null)
 {
     parent::__construct();
     $this->cache = $cache;
     $this->provider = $provider;
     $this->lifetime = $lifetime;
     $this->locale = $locale;
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(HttpAdapterInterface $adapter, $locale = null)
 {
     parent::__construct($adapter, $locale);
     $this->setUrl('http://maps.googleapis.com/maps/api/geocode');
     $this->setHttps(false);
     $this->setFormat('json');
     $this->setXmlParser(new XmlParser());
 }
Example #7
0
 /**
  * @param string   $datFile
  * @param int|null $openFlag
  *
  * @throws FunctionNotFound If maxmind's lib not installed.
  * @throws InvalidArgument  If dat file is not correct (optional).
  */
 public function __construct($datFile, $openFlag = null)
 {
     if (false === function_exists('geoip_open')) {
         throw new FunctionNotFound('geoip_open', 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoip.inc file?');
     }
     if (false === function_exists('GeoIP_record_by_addr')) {
         throw new FunctionNotFound('GeoIP_record_by_addr', 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoipcity.inc file?');
     }
     if (false === is_file($datFile)) {
         throw new InvalidArgument(sprintf('Given MaxMind dat file "%s" does not exist.', $datFile));
     }
     if (false === is_readable($datFile)) {
         throw new InvalidArgument(sprintf('Given MaxMind dat file "%s" does not readable.', $datFile));
     }
     $this->datFile = $datFile;
     $this->openFlag = null === $openFlag ? GEOIP_STANDARD : $openFlag;
     parent::__construct();
 }
Example #8
0
 /**
  * @param HttpAdapterInterface $adapter  An HTTP adapter.
  * @param string               $username Username login (Free registration at http://www.geonames.org/login)
  * @param string               $locale   A locale (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $username, $locale = null)
 {
     parent::__construct($adapter, $locale);
     $this->username = $username;
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $type    Data to lookup
  */
 public function __construct(HttpAdapterInterface $adapter, $type = 'countries')
 {
     parent::__construct($adapter, null);
     $this->type = strtolower($type);
 }
Example #10
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter
  */
 public function __construct(HttpAdapterInterface $adapter)
 {
     parent::__construct();
     $this->adapter = $adapter;
 }
 /**
  * @param HttpAdapterInterface $adapter  An HTTP adapter.
  * @param string               $apiKey   An API key.
  * @param string|null          $locale   A locale (optional).
  * @param bool                 $licensed True to use MapQuest's licensed endpoints, default is false to use the open endpoints (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey, $locale = null, $licensed = false)
 {
     parent::__construct($adapter, $locale);
     $this->apiKey = $apiKey;
     $this->licensed = $licensed;
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $rootUrl Root URL of the nominatim server
  * @param string               $locale  A locale (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $rootUrl, $locale = null)
 {
     parent::__construct($adapter, $locale);
     $this->rootUrl = rtrim($rootUrl, '/');
 }
Example #13
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $locale  A locale (optional).
  * @param string               $toponym Toponym biasing only for reverse geocoding (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $locale = null, $toponym = null)
 {
     parent::__construct($adapter, $locale);
     $this->toponym = $toponym;
 }
 public function getLocalhostDefaults()
 {
     return parent::getLocalhostDefaults();
 }
Example #15
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $locale  A locale (optional).
  * @param string               $region  Region biasing (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $locale = null, $region = null)
 {
     parent::__construct($adapter, $locale);
     $this->region = $region;
 }
Example #16
0
 public function __construct(Provider $provider, LoggerInterface $logger)
 {
     parent::__construct();
     $this->provider = $provider;
     $this->logger = $logger;
 }
Example #17
0
 public function __construct(ProviderAggregator $aggregator, AddressComparator $comparator)
 {
     parent::__construct();
     $this->aggregator = $aggregator;
     $this->comparator = $comparator;
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $apiKey  An API key.
  * @param bool                 $useSsl  Whether to use an SSL connection (optional).
  * @param string|null          $locale  A locale (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey, $useSsl = false, $locale = null)
 {
     parent::__construct($adapter, $locale);
     $this->apiKey = $apiKey;
     $this->scheme = $useSsl ? 'https' : $this->scheme;
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $apiKey  An API key.
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey)
 {
     parent::__construct($adapter);
     $this->apiKey = $apiKey;
 }
Example #20
0
 public function __construct(Provider $provider, AddressComparator $comparator)
 {
     parent::__construct();
     $this->provider = $provider;
     $this->comparator = $comparator;
 }
 /**
  * @param HttpAdapterInterface $adapter       An HTTP adapter.
  * @param string               $sourceCountry Country biasing (optional).
  * @param bool                 $useSsl        Whether to use an SSL connection (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $sourceCountry = null, $useSsl = false)
 {
     parent::__construct($adapter);
     $this->sourceCountry = $sourceCountry;
     $this->protocol = $useSsl ? 'https' : 'http';
 }
Example #22
0
 public function __construct(GeoIP2Adapter $adapter, $locale = 'en')
 {
     parent::__construct();
     $this->adapter = $adapter;
     $this->locale = $locale;
 }
Example #23
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $apiKey  An API key.
  * @param string               $locale  A locale (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey, $locale = null)
 {
     parent::__construct($adapter, $locale);
     $this->apiKey = $apiKey;
 }
 /**
  * @param HttpClient          $client
  * @param MessageFactory|null $factory
  */
 public function __construct(HttpClient $client, MessageFactory $factory = null)
 {
     parent::__construct();
     $this->client = $client;
     $this->messageFactory = $factory;
 }