__construct() public method

public __construct ( Http\Client\HttpClient $client, Http\Message\MessageFactory $factory = null )
$client Http\Client\HttpClient
$factory Http\Message\MessageFactory
Beispiel #1
0
 /**
  * @param HttpClient  $client 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(HttpClient $client, $apiKey, $useSsl = false, $locale = null)
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
     $this->scheme = $useSsl ? 'https' : 'http';
     $this->locale = $locale;
 }
Beispiel #2
0
 /**
  * @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);
     $this->apiKey = $apiKey;
     $this->scheme = $useSsl ? 'https' : 'http';
     $this->locale = $locale;
 }
Beispiel #3
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);
     $this->apiKey = $apiKey;
     $this->service = $service;
     $this->useSsl = $useSsl;
 }
Beispiel #4
0
 /**
  * @param HttpClient $client  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(HttpClient $client, $apiKey, $service = self::CITY_EXTENDED_SERVICE, $useSsl = false)
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
     $this->service = $service;
     $this->useSsl = $useSsl;
 }
Beispiel #5
0
 /**
  * @param HttpClient $client 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(HttpClient $client, $locale = null, $region = null, $useSsl = false, $apiKey = null)
 {
     parent::__construct($client);
     $this->locale = $locale;
     $this->region = $region;
     $this->useSsl = $useSsl;
     $this->apiKey = $apiKey;
 }
Beispiel #6
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter
  * @param string               $apiKey  Mapbox API key
  * @param string               $country  A country (optional)
  * @param string               $proximity  Proximity biasing (optional)
  * @param bool                 $useSsl  Whether to use an SSL connection (optional)
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey, $country = null, $proximity = null, $useSsl = false)
 {
     parent::__construct($adapter);
     $this->country = $country;
     $this->proximity = $proximity;
     $this->useSsl = $useSsl;
     $this->apiKey = $apiKey;
 }
Beispiel #7
0
 /**
  * @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);
     $this->locale = $locale;
     $this->region = $region;
     $this->useSsl = $useSsl;
     $this->apiKey = $apiKey;
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $appId   An App ID.
  * @param string               $apoCode An App code.
  * @param string               $locale  A locale (optional).
  */
 public function __construct(HttpAdapterInterface $adapter, $appId, $appCode, $locale = null)
 {
     parent::__construct($adapter);
     if ($locale) {
         $this->setLocale($locale);
     }
     $this->appId = $appId;
     $this->appCode = $appCode;
 }
Beispiel #9
0
 /**
  * @param HttpClient $client    An HTTP adapter.
  * @param string     $apiKey    An API key.
  * @param string     $precision The endpoint precision. Either "city" or "country" (faster)
  *
  * @throws \Geocoder\Exception\InvalidArgument
  */
 public function __construct(HttpClient $client, $apiKey, $precision = 'city')
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
     switch ($precision) {
         case 'city':
             $this->endpointUrl = self::CITY_PRECISION_ENDPOINT_URL;
             break;
         case 'country':
             $this->endpointUrl = self::COUNTRY_PRECISION_ENDPOINT_URL;
             break;
         default:
             throw new InvalidArgument(sprintf('Invalid precision value "%s" (allowed values: "city", "country").', $precision));
     }
 }
Beispiel #10
0
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $endpoint Root URL of the SPARQL knowledge base
  * @param string               $user authenticatd user.     
  * @param string               $user authenticatd password.
  */
 public function __construct(HttpAdapterInterface $adapter, $kbid = null, $secretKey = null, $endpoint = null)
 {
     if (is_null($kbid)) {
         $kbid = 'demo';
     }
     if (is_null($secretKey)) {
         $secretKey = 'demo';
     }
     if (is_null($endpoint)) {
         $endpoint = "https://hub1.linkeddata.center/{$kbid}";
     }
     HttpClient::useIdentity($kbid, $secretKey);
     $this->sparql = new SparqlClient("{$endpoint}/sparql");
     parent::__construct($adapter);
 }
Beispiel #11
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);
     $this->apiKey = $apiKey;
     $this->locale = $locale;
 }
Beispiel #12
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);
     $this->locale = $locale;
     $this->toponym = $toponym;
 }
Beispiel #13
0
 /**
  * @param HttpClient $client        An HTTP adapter
  * @param string     $sourceCountry Country biasing (optional)
  * @param bool       $useSsl        Whether to use an SSL connection (optional)
  */
 public function __construct(HttpClient $client, $sourceCountry = null, $useSsl = false)
 {
     parent::__construct($client);
     $this->sourceCountry = $sourceCountry;
     $this->protocol = $useSsl ? 'https' : 'http';
 }
 /**
  * @param HttpAdapterInterface $adapter An HTTP adapter.
  * @param string               $apiKey  An API key.
  */
 public function __construct(HttpAdapterInterface $adapter, $apiKey)
 {
     parent::__construct($adapter);
     $this->apiKey = $apiKey;
 }
Beispiel #15
0
 /**
  * @param HttpClient $client   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(HttpClient $client, $username, $locale = null)
 {
     parent::__construct($client);
     $this->username = $username;
     $this->locale = $locale;
 }
Beispiel #16
0
 /**
  * @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';
 }
Beispiel #17
0
 /**
  * @param HttpClient $client An HTTP adapter.
  * @param string     $apiKey An API key.
  * @param string     $locale A locale (optional).
  */
 public function __construct(HttpClient $client, $apiKey, $locale = null)
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
     $this->locale = $locale;
 }
Beispiel #18
0
 /**
  * @param HttpClient $client   An HTTP adapter.
  * @param string     $apiKey   An API key.
  * @param bool       $licensed True to use MapQuest's licensed endpoints, default is false to use the open endpoints (optional).
  */
 public function __construct(HttpClient $client, $apiKey, $licensed = false)
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
     $this->licensed = $licensed;
 }
Beispiel #19
0
 /**
  * @param HttpClient $client  An HTTP adapter.
  * @param string     $rootUrl Root URL of the nominatim server
  * @param string     $locale  A locale (optional).
  */
 public function __construct(HttpClient $client, $rootUrl, $locale = null)
 {
     parent::__construct($client);
     $this->rootUrl = rtrim($rootUrl, '/');
     $this->locale = $locale;
 }
Beispiel #20
0
 /**
  * @param HttpClient $client An HTTP adapter
  * @param string     $apiKey An API key
  */
 public function __construct(HttpClient $client, $apiKey)
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
 }
Beispiel #21
0
 /**
  * @param HttpClient $client  An HTTP adapter.
  * @param string     $locale  A locale (optional).
  * @param string     $toponym Toponym biasing only for reverse geocoding (optional).
  */
 public function __construct(HttpClient $client, $locale = null, $toponym = null)
 {
     parent::__construct($client);
     $this->locale = $locale;
     $this->toponym = $toponym;
 }
Beispiel #22
0
 /**
  * @param HttpClient  $client An HTTP adapter.
  * @param string      $apiKey An API key.
  * @param bool        $useSsl Whether to use an SSL connection (optional).
  */
 public function __construct(HttpClient $client, $apiKey, $useSSL = true)
 {
     parent::__construct($client);
     $this->apiKey = $apiKey;
     $this->scheme = $useSSL ? 'https' : 'http';
 }
Beispiel #23
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);
     $this->username = $username;
     $this->locale = $locale;
 }
Beispiel #24
0
 /**
  * @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);
     $this->rootUrl = rtrim($rootUrl, '/');
     $this->locale = $locale;
 }
Beispiel #25
0
 /**
  * @param HttpAdapterInterface $adapter  An HTTP adapter.
  * @param string               $apiKey   An API key.
  * @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, $licensed = false)
 {
     parent::__construct($adapter);
     $this->apiKey = $apiKey;
     $this->licensed = $licensed;
 }