forked from maxmind/GeoIP2-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Connection-Type, Domain, and ISP databases
- Loading branch information
Showing
9 changed files
with
249 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule maxmind-db
updated
26 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace GeoIp2\Model; | ||
|
||
|
||
/** | ||
* @ignore | ||
*/ | ||
abstract class AbstractModel implements \JsonSerializable | ||
{ | ||
private $raw; | ||
|
||
|
||
/** | ||
* @ignore | ||
*/ | ||
public function __construct($raw) | ||
{ | ||
$this->raw = $raw; | ||
} | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
protected function get($field) | ||
{ | ||
return isset($this->raw[$field]) ? $this->raw[$field] : array(); | ||
} | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public function __get($attr) | ||
{ | ||
if ($attr != "instance" && isset($this->$attr)) { | ||
return $this->$attr; | ||
} | ||
|
||
throw new \RuntimeException("Unknown attribute: $attr"); | ||
} | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public function __isset($attr) | ||
{ | ||
return $attr != "instance" && isset($this->$attr); | ||
} | ||
|
||
public function jsonSerialize() | ||
{ | ||
return $this->raw; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace GeoIp2\Model; | ||
|
||
/** | ||
* This class provides the GeoIP2 Connection-Type model. | ||
* | ||
* @property string $connectionType The connection type may take the following | ||
* values: "Dialup", "Cable/DSL", "Corporate", "Cellular". Additional | ||
* values may be added in the future. | ||
* | ||
* @property string $ipAddress The IP address that the data in the model is | ||
* for. | ||
* | ||
*/ | ||
class ConnectionType extends AbstractModel | ||
{ | ||
protected $connectionType; | ||
protected $ipAddress; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public function __construct($raw) | ||
{ | ||
parent::__construct($raw); | ||
|
||
$this->connectionType = $this->get('connection_type'); | ||
$this->ipAddress = $this->get('ip_address'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace GeoIp2\Model; | ||
|
||
/** | ||
* This class provides the GeoIP2 Domain model. | ||
* | ||
* @property string $domain The second level domain associated with the IP | ||
* address. This will be something like "example.com" or "example.co.uk", | ||
* not "foo.example.com". | ||
* | ||
* @property string $ipAddress The IP address that the data in the model is | ||
* for. | ||
* | ||
*/ | ||
class Domain extends AbstractModel | ||
{ | ||
protected $domain; | ||
protected $ipAddress; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public function __construct($raw) | ||
{ | ||
parent::__construct($raw); | ||
|
||
$this->domain = $this->get('domain'); | ||
$this->ipAddress = $this->get('ip_address'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace GeoIp2\Model; | ||
|
||
/** | ||
* This class provides the GeoIP2 Connection-Type model. | ||
* | ||
* @property integer $autonomousSystemNumber The autonomous system number | ||
* associated with the IP address. | ||
* | ||
* @property string $autonomousSystemOrganization The organization associated | ||
* with the registered autonomous system number for the IP address. | ||
* | ||
* @property string $isp The name of the ISP associated with the IP address. | ||
* | ||
* @property string $organization The name of the organization associated with | ||
* the IP address. | ||
* | ||
* @property string $ipAddress The IP address that the data in the model is | ||
* for. | ||
* | ||
*/ | ||
class Isp extends AbstractModel | ||
{ | ||
protected $autonomousSystemNumber; | ||
protected $autonomousSystemOrganization; | ||
protected $isp; | ||
protected $organization; | ||
protected $ipAddress; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public function __construct($raw) | ||
{ | ||
parent::__construct($raw); | ||
$this->autonomousSystemNumber = $this->get('autonomous_system_number'); | ||
$this->autonomousSystemOrganization = | ||
$this->get('autonomous_system_organization'); | ||
$this->isp = $this->get('isp'); | ||
$this->organization = $this->get('organization'); | ||
|
||
$this->ipAddress = $this->get('ip_address'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters