Rename GeoIP2 => GeoIp2 for consistency
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic error.
|
||||
*/
|
||||
class GeoIP2Exception extends \Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents a generic error.
|
||||
*/
|
||||
class GeoIp2Exception extends \Exception
|
||||
{
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Exception;
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an HTTP transport error.
|
||||
*/
|
||||
|
||||
class HttpException extends GeoIP2Exception
|
||||
class HttpException extends GeoIp2Exception
|
||||
{
|
||||
/**
|
||||
* The URI queried
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Exception;
|
||||
namespace GeoIp2\Exception;
|
||||
|
||||
/**
|
||||
* This class represents an error returned by MaxMind's GeoIP2
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Model;
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides a model for the data returned by the GeoIP2
|
||||
@@ -10,33 +10,33 @@ namespace GeoIP2\Model;
|
||||
* classes is which fields in each record may be populated. See
|
||||
* http://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property \GeoIP2\Record\City $city City data for the requested IP
|
||||
* @property \GeoIp2\Record\City $city City data for the requested IP
|
||||
* address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Continent $continent Continent data for the
|
||||
* @property \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $country Country data for the requested
|
||||
* @property \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
*
|
||||
* @property \GeoIP2\Record\Location $location Location data for the
|
||||
* @property \GeoIp2\Record\Location $location Location data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* @property \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $registeredCountry Registered country
|
||||
* @property \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
*
|
||||
* @property \GeoIP2\Record\RepresentedCountry $representedCountry
|
||||
* @property \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases or embassies. It is only
|
||||
* present when the represented country differs from the country.
|
||||
*
|
||||
* @property array $subdivisions An array of {@link \GeoIP2\Record\Subdivision}
|
||||
* @property array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
|
||||
* objects representing the country subdivisions for the requested IP
|
||||
* address. The number and type of subdivisions varies by country, but a
|
||||
* subdivision is typically a state, province, county, etc. Subdivisions
|
||||
@@ -44,12 +44,12 @@ namespace GeoIP2\Model;
|
||||
* If the response did not contain any subdivisions, this method returns
|
||||
* an empty array.
|
||||
*
|
||||
* @property \GeoIP2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* @property \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* representing the most specific subdivision returned. If the response
|
||||
* did not contain any subdivisions, this method returns an empty
|
||||
* {@link \GeoIP2\Record\Subdivision} object.
|
||||
* {@link \GeoIp2\Record\Subdivision} object.
|
||||
*
|
||||
* @property \GeoIP2\Record\Traits $traits Data for the traits of the
|
||||
* @property \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class City extends Country
|
||||
@@ -78,9 +78,9 @@ class City extends Country
|
||||
{
|
||||
parent::__construct($raw, $languages);
|
||||
|
||||
$this->city = new \GeoIP2\Record\City($this->get('city'), $languages);
|
||||
$this->location = new \GeoIP2\Record\Location($this->get('location'));
|
||||
$this->postal = new \GeoIP2\Record\Postal($this->get('postal'));
|
||||
$this->city = new \GeoIp2\Record\City($this->get('city'), $languages);
|
||||
$this->location = new \GeoIp2\Record\Location($this->get('location'));
|
||||
$this->postal = new \GeoIp2\Record\Postal($this->get('postal'));
|
||||
|
||||
$this->createSubdivisions($raw, $languages);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class City extends Country
|
||||
foreach ($raw['subdivisions'] as $sub) {
|
||||
array_push(
|
||||
$this->subdivisions,
|
||||
new \GeoIP2\Record\Subdivision($sub, $languages)
|
||||
new \GeoIp2\Record\Subdivision($sub, $languages)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class City extends Country
|
||||
private function mostSpecificSubdivision()
|
||||
{
|
||||
return empty($this->subdivisions)?
|
||||
new \GeoIP2\Record\Subdivision(array(), $this->languages):
|
||||
new \GeoIp2\Record\Subdivision(array(), $this->languages):
|
||||
end($this->subdivisions);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Model;
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides a model for the data returned by the GeoIP2
|
||||
@@ -10,33 +10,33 @@ namespace GeoIP2\Model;
|
||||
* classes is which fields in each record may be populated. See
|
||||
* http://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property \GeoIP2\Record\City $city City data for the requested IP
|
||||
* @property \GeoIp2\Record\City $city City data for the requested IP
|
||||
* address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Continent $continent Continent data for the
|
||||
* @property \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $country Country data for the requested
|
||||
* @property \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
*
|
||||
* @property \GeoIP2\Record\Location $location Location data for the
|
||||
* @property \GeoIp2\Record\Location $location Location data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* @property \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $registeredCountry Registered country
|
||||
* @property \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
*
|
||||
* @property \GeoIP2\Record\RepresentedCountry $representedCountry
|
||||
* @property \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases or embassies. It is only
|
||||
* present when the represented country differs from the country.
|
||||
*
|
||||
* @property array $subdivisions An array of {@link \GeoIP2\Record\Subdivision}
|
||||
* @property array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
|
||||
* objects representing the country subdivisions for the requested IP
|
||||
* address. The number and type of subdivisions varies by country, but a
|
||||
* subdivision is typically a state, province, county, etc. Subdivisions
|
||||
@@ -44,12 +44,12 @@ namespace GeoIP2\Model;
|
||||
* If the response did not contain any subdivisions, this method returns
|
||||
* an empty array.
|
||||
*
|
||||
* @property \GeoIP2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* @property \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* representing the most specific subdivision returned. If the response
|
||||
* did not contain any subdivisions, this method returns an empty
|
||||
* {@link \GeoIP2\Record\Subdivision} object.
|
||||
* {@link \GeoIp2\Record\Subdivision} object.
|
||||
*
|
||||
* @property \GeoIP2\Record\Traits $traits Data for the traits of the
|
||||
* @property \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class CityIspOrg extends City
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Model;
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides a model for the data returned by the GeoIP2 Country
|
||||
@@ -10,27 +10,27 @@ namespace GeoIP2\Model;
|
||||
* classes is which fields in each record may be populated. See
|
||||
* http://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property \GeoIP2\Record\Continent $continent Continent data for the
|
||||
* @property \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $country Country data for the requested
|
||||
* @property \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
*
|
||||
* @property \GeoIP2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* @property \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $registeredCountry Registered country
|
||||
* @property \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
*
|
||||
* @property \GeoIP2\Record\RepresentedCountry $representedCountry
|
||||
* @property \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases or embassies. It is only
|
||||
* present when the represented country differs from the country.
|
||||
*
|
||||
* @property \GeoIP2\Record\Traits $traits Data for the traits of the
|
||||
* @property \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class Country
|
||||
@@ -51,24 +51,24 @@ class Country
|
||||
{
|
||||
$this->raw = $raw;
|
||||
|
||||
$this->continent = new \GeoIP2\Record\Continent(
|
||||
$this->continent = new \GeoIp2\Record\Continent(
|
||||
$this->get('continent'),
|
||||
$languages
|
||||
);
|
||||
$this->country = new \GeoIP2\Record\Country(
|
||||
$this->country = new \GeoIp2\Record\Country(
|
||||
$this->get('country'),
|
||||
$languages
|
||||
);
|
||||
$this->maxmind = new \GeoIP2\Record\MaxMind($this->get('maxmind'));
|
||||
$this->registeredCountry = new \GeoIP2\Record\Country(
|
||||
$this->maxmind = new \GeoIp2\Record\MaxMind($this->get('maxmind'));
|
||||
$this->registeredCountry = new \GeoIp2\Record\Country(
|
||||
$this->get('registered_country'),
|
||||
$languages
|
||||
);
|
||||
$this->representedCountry = new \GeoIP2\Record\RepresentedCountry(
|
||||
$this->representedCountry = new \GeoIp2\Record\RepresentedCountry(
|
||||
$this->get('represented_country'),
|
||||
$languages
|
||||
);
|
||||
$this->traits = new \GeoIP2\Record\Traits($this->get('traits'));
|
||||
$this->traits = new \GeoIp2\Record\Traits($this->get('traits'));
|
||||
|
||||
$this->languages = $languages;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Model;
|
||||
namespace GeoIp2\Model;
|
||||
|
||||
/**
|
||||
* This class provides a model for the data returned by the GeoIP2
|
||||
@@ -10,33 +10,33 @@ namespace GeoIP2\Model;
|
||||
* classes is which fields in each record may be populated. See
|
||||
* http://dev.maxmind.com/geoip/geoip2/web-services more details.
|
||||
*
|
||||
* @property \GeoIP2\Record\City $city City data for the requested IP
|
||||
* @property \GeoIp2\Record\City $city City data for the requested IP
|
||||
* address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Continent $continent Continent data for the
|
||||
* @property \GeoIp2\Record\Continent $continent Continent data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $country Country data for the requested
|
||||
* @property \GeoIp2\Record\Country $country Country data for the requested
|
||||
* IP address. This object represents the country where MaxMind believes the
|
||||
* end user is located.
|
||||
*
|
||||
* @property \GeoIP2\Record\Location $location Location data for the
|
||||
* @property \GeoIp2\Record\Location $location Location data for the
|
||||
* requested IP address.
|
||||
*
|
||||
* @property \GeoIP2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* @property \GeoIp2\Record\MaxMind $maxmind Data related to your MaxMind
|
||||
* account.
|
||||
*
|
||||
* @property \GeoIP2\Record\Country $registeredCountry Registered country
|
||||
* @property \GeoIp2\Record\Country $registeredCountry Registered country
|
||||
* data for the requested IP address. This record represents the country
|
||||
* where the ISP has registered a given IP block and may differ from the
|
||||
* user's country.
|
||||
*
|
||||
* @property \GeoIP2\Record\RepresentedCountry $representedCountry
|
||||
* @property \GeoIp2\Record\RepresentedCountry $representedCountry
|
||||
* Represented country data for the requested IP address. The represented
|
||||
* country is used for things like military bases or embassies. It is only
|
||||
* present when the represented country differs from the country.
|
||||
*
|
||||
* @property array $subdivisions An array of {@link \GeoIP2\Record\Subdivision}
|
||||
* @property array $subdivisions An array of {@link \GeoIp2\Record\Subdivision}
|
||||
* objects representing the country subdivisions for the requested IP
|
||||
* address. The number and type of subdivisions varies by country, but a
|
||||
* subdivision is typically a state, province, county, etc. Subdivisions
|
||||
@@ -44,12 +44,12 @@ namespace GeoIP2\Model;
|
||||
* If the response did not contain any subdivisions, this method returns
|
||||
* an empty array.
|
||||
*
|
||||
* @property \GeoIP2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* @property \GeoIp2\Record\Subdivision $mostSpecificSubdivision An object
|
||||
* representing the most specific subdivision returned. If the response
|
||||
* did not contain any subdivisions, this method returns an empty
|
||||
* {@link \GeoIP2\Record\Subdivision} object.
|
||||
* {@link \GeoIp2\Record\Subdivision} object.
|
||||
*
|
||||
* @property \GeoIP2\Record\Traits $traits Data for the traits of the
|
||||
* @property \GeoIp2\Record\Traits $traits Data for the traits of the
|
||||
* requested IP address.
|
||||
*/
|
||||
class Omni extends CityIspOrg
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
abstract class AbstractPlaceRecord extends AbstractRecord
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
abstract class AbstractRecord
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* City-level data associated with an IP address.
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the continent record associated with an IP address
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the country record associated with an IP address
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the location record associated with an IP address
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data about your account.
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the postal record associated with an IP address
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
* Contains data for the represented country associated with an IP address
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Record;
|
||||
namespace GeoIp2\Record;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\WebService;
|
||||
namespace GeoIp2\WebService;
|
||||
|
||||
use GeoIP2\Exception\GeoIP2Exception;
|
||||
use GeoIP2\Exception\HttpException;
|
||||
use GeoIP2\Exception\WebServiceException;
|
||||
use GeoIP2\Model\City;
|
||||
use GeoIP2\Model\CityIspOrg;
|
||||
use GeoIP2\Model\Country;
|
||||
use GeoIP2\Model\Omni;
|
||||
use GeoIp2\Exception\GeoIp2Exception;
|
||||
use GeoIp2\Exception\HttpException;
|
||||
use GeoIp2\Exception\WebServiceException;
|
||||
use GeoIp2\Model\City;
|
||||
use GeoIp2\Model\CityIspOrg;
|
||||
use GeoIp2\Model\Country;
|
||||
use GeoIp2\Model\Omni;
|
||||
use Guzzle\Http\Client as GuzzleClient;
|
||||
use Guzzle\Common\Exception\RuntimeException;
|
||||
use Guzzle\Http\Exception\ClientErrorResponseException;
|
||||
use Guzzle\Http\Exception\ServerErrorResponseException;
|
||||
|
||||
/**
|
||||
* This class provides a client API for all the GeoIP2 web service's
|
||||
* This class provides a client API for all the GeoIp2 web service's
|
||||
* end points. The end points are Country, City, City/ISP/Org, and Omni. Each
|
||||
* end point returns a different set of data about an IP address, with Country
|
||||
* returning the least data and Omni the most.
|
||||
@@ -52,18 +52,18 @@ use Guzzle\Http\Exception\ServerErrorResponseException;
|
||||
* service docs}.
|
||||
*
|
||||
* If the web service returns an explicit error document, this is thrown as a
|
||||
* {@link \GeoIP2\Exception\WebServiceException}. If some other sort of
|
||||
* {@link \GeoIp2\Exception\WebServiceException}. If some other sort of
|
||||
* transport error occurs, this is thrown as a {@link
|
||||
* \GeoIP2\Exception\HttpException}. The difference is that the web service
|
||||
* \GeoIp2\Exception\HttpException}. The difference is that the web service
|
||||
* error includes an error message and error code delivered by the web
|
||||
* service. The latter is thrown when some sort of unanticipated error occurs,
|
||||
* such as the web service returning a 500 or an invalid error document.
|
||||
*
|
||||
* If the web service returns any status code besides 200, 4xx, or 5xx, this
|
||||
* also becomes a {@link \GeoIP2\Exception\HttpException}.
|
||||
* also becomes a {@link \GeoIp2\Exception\HttpException}.
|
||||
*
|
||||
* Finally, if the web service returns a 200 but the body is invalid, the
|
||||
* client throws a {@link \GeoIP2\Exception\GeoIP2Exception}.
|
||||
* client throws a {@link \GeoIp2\Exception\GeoIp2Exception}.
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
@@ -106,14 +106,14 @@ class Client
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @return \GeoIP2\Model\City
|
||||
* @return \GeoIp2\Model\City
|
||||
*
|
||||
* @throws \GeoIP2\Exception\GeoIP2Exception if there was a generic
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception if there was a generic
|
||||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* @throws \GeoIp2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
* @throws \GeoIp2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIp2 web service.
|
||||
*/
|
||||
public function city($ipAddress = 'me')
|
||||
{
|
||||
@@ -127,14 +127,14 @@ class Client
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @return \GeoIP2\Model\Country
|
||||
* @return \GeoIp2\Model\Country
|
||||
*
|
||||
* @throws \GeoIP2\Exception\GeoIP2Exception if there was a generic
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception if there was a generic
|
||||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* @throws \GeoIp2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
* @throws \GeoIp2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIp2 web service.
|
||||
*/
|
||||
public function country($ipAddress = 'me')
|
||||
{
|
||||
@@ -148,14 +148,14 @@ class Client
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @return \GeoIP2\Model\CityIspOrg
|
||||
* @return \GeoIp2\Model\CityIspOrg
|
||||
*
|
||||
* @throws \GeoIP2\Exception\GeoIP2Exception if there was a generic
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception if there was a generic
|
||||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* @throws \GeoIp2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
* @throws \GeoIp2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIp2 web service.
|
||||
*/
|
||||
public function cityIspOrg($ipAddress = 'me')
|
||||
{
|
||||
@@ -169,14 +169,14 @@ class Client
|
||||
* address is provided, the address that the web service is called
|
||||
* from will be used.
|
||||
*
|
||||
* @return \GeoIP2\Model\Omni
|
||||
* @return \GeoIp2\Model\Omni
|
||||
*
|
||||
* @throws \GeoIP2\Exception\GeoIP2Exception if there was a generic
|
||||
* @throws \GeoIp2\Exception\GeoIp2Exception if there was a generic
|
||||
* error processing your request.
|
||||
* @throws \GeoIP2\Exception\HttpException if there was an HTTP transport
|
||||
* @throws \GeoIp2\Exception\HttpException if there was an HTTP transport
|
||||
* error.
|
||||
* @throws \GeoIP2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIP2 web service.
|
||||
* @throws \GeoIp2\Exception\WebServiceException if an error was returned
|
||||
* by MaxMind's GeoIp2 web service.
|
||||
*/
|
||||
public function omni($ipAddress = 'me')
|
||||
{
|
||||
@@ -206,7 +206,7 @@ class Client
|
||||
|
||||
if ($response && $response->isSuccessful()) {
|
||||
$body = $this->handleSuccess($response, $uri);
|
||||
$class = "GeoIP2\\Model\\" . $class;
|
||||
$class = "GeoIp2\\Model\\" . $class;
|
||||
return new $class($body, $this->languages);
|
||||
} else {
|
||||
$this->handleNon200($response, $uri);
|
||||
@@ -216,7 +216,7 @@ class Client
|
||||
private function handleSuccess($response, $uri)
|
||||
{
|
||||
if ($response->getContentLength() == 0) {
|
||||
throw new GeoIP2Exception(
|
||||
throw new GeoIp2Exception(
|
||||
"Received a 200 response for $uri but did not " .
|
||||
"receive a HTTP body."
|
||||
);
|
||||
@@ -225,7 +225,7 @@ class Client
|
||||
try {
|
||||
return $response->json();
|
||||
} catch (RuntimeException $e) {
|
||||
throw new GeoIP2Exception(
|
||||
throw new GeoIp2Exception(
|
||||
"Received a 200 response for $uri but could not decode " .
|
||||
"the response as JSON: " . $e->getMessage()
|
||||
);
|
||||
@@ -244,7 +244,7 @@ class Client
|
||||
try {
|
||||
$body = $response->json();
|
||||
if (!isset($body['code']) || !isset($body['error'])) {
|
||||
throw new GeoIP2Exception(
|
||||
throw new GeoIp2Exception(
|
||||
'Response contains JSON but it does not specify ' .
|
||||
'code or error keys: ' . $response->getBody()
|
||||
);
|
||||
Reference in New Issue
Block a user