Added iterface for Reader/Client.
It could use a better name.
This commit is contained in:
parent
c584dbfd6b
commit
167433de0c
|
@ -7,6 +7,7 @@ use GeoIp2\Model\City;
|
|||
use GeoIp2\Model\CityIspOrg;
|
||||
use GeoIp2\Model\Country;
|
||||
use GeoIp2\Model\Omni;
|
||||
use GeoIp2\ProviderInterface;
|
||||
use MaxMind\Db\Reader as DbReader;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,7 @@ use MaxMind\Db\Reader as DbReader;
|
|||
* will be thrown.
|
||||
*
|
||||
*/
|
||||
class Reader
|
||||
class Reader implements ProviderInterface
|
||||
{
|
||||
private $dbReader;
|
||||
private $languages;
|
||||
|
|
34
src/GeoIp2/ProviderInterface.php
Normal file
34
src/GeoIp2/ProviderInterface.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace GeoIp2;
|
||||
|
||||
interface ProviderInterface
|
||||
{
|
||||
/**
|
||||
* @param ipAddress
|
||||
* IPv4 or IPv6 address to lookup.
|
||||
* @return A Country model for the requested IP address.
|
||||
*/
|
||||
public function country($ipAddress);
|
||||
|
||||
/**
|
||||
* @param ipAddress
|
||||
* IPv4 or IPv6 address to lookup.
|
||||
* @return A City model for the requested IP address.
|
||||
*/
|
||||
public function city($ipAddress);
|
||||
|
||||
/**
|
||||
* @param ipAddress
|
||||
* IPv4 or IPv6 address to lookup.
|
||||
* @return A CityIspOrg model for the requested IP address.
|
||||
*/
|
||||
public function cityIspOrg($ipAddress);
|
||||
|
||||
/**
|
||||
* @param ipAddress
|
||||
* IPv4 or IPv6 address to lookup.
|
||||
* @return An Omni model for the requested IP address.
|
||||
*/
|
||||
public function omni($ipAddress);
|
||||
}
|
|
@ -12,6 +12,7 @@ use GeoIp2\Model\City;
|
|||
use GeoIp2\Model\CityIspOrg;
|
||||
use GeoIp2\Model\Country;
|
||||
use GeoIp2\Model\Omni;
|
||||
use GeoIp2\ProviderInterface;
|
||||
use Guzzle\Http\Client as GuzzleClient;
|
||||
use Guzzle\Common\Exception\RuntimeException;
|
||||
use Guzzle\Http\Exception\ClientErrorResponseException;
|
||||
|
@ -48,7 +49,7 @@ use Guzzle\Http\Exception\ServerErrorResponseException;
|
|||
*
|
||||
* If the request fails, the client class throws an exception.
|
||||
*/
|
||||
class Client
|
||||
class Client implements ProviderInterface
|
||||
{
|
||||
private $userId;
|
||||
private $licenseKey;
|
||||
|
|
Loading…
Reference in New Issue
Block a user