| 1 | <?php |
||
| 10 | class Host |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Contains all the properties of the host. |
||
| 14 | * |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $properties; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Create an Host object with all the properties. |
||
| 21 | * |
||
| 22 | * @param array $properties |
||
| 23 | */ |
||
| 24 | 5 | public function __construct($properties = array()) |
|
| 25 | { |
||
| 26 | //Merge default values |
||
| 27 | 5 | $this->properties = array_merge(array( |
|
| 28 | 5 | Ipinfo::CITY => '', |
|
| 29 | 5 | Ipinfo::COUNTRY => '', |
|
| 30 | 5 | Ipinfo::HOSTNAME => '', |
|
| 31 | 5 | Ipinfo::IP => '', |
|
| 32 | 5 | Ipinfo::LOC => '', |
|
| 33 | 5 | Ipinfo::ORG => '', |
|
| 34 | 5 | Ipinfo::PHONE => '', |
|
| 35 | 5 | Ipinfo::POSTAL => '', |
|
| 36 | 5 | Ipinfo::REGION => '', |
|
| 37 | 5 | ), $properties); |
|
| 38 | 5 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Get the city value. |
||
| 42 | */ |
||
| 43 | 1 | public function getCity() |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Get the country value. |
||
| 50 | */ |
||
| 51 | public function getCountry() |
||
| 52 | { |
||
| 53 | return $this->properties[Ipinfo::COUNTRY]; |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Get the hostname value. |
||
| 58 | */ |
||
| 59 | public function getHostname() |
||
| 60 | { |
||
| 61 | return $this->properties[Ipinfo::HOSTNAME]; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Get the ip value. |
||
| 66 | */ |
||
| 67 | public function getIp() |
||
| 68 | { |
||
| 69 | return $this->properties[Ipinfo::IP]; |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Get the loc value. |
||
| 74 | */ |
||
| 75 | public function getLoc() |
||
| 76 | { |
||
| 77 | return $this->properties[Ipinfo::LOC]; |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Get the org value. |
||
| 82 | */ |
||
| 83 | public function getOrg() |
||
| 84 | { |
||
| 85 | return $this->properties[Ipinfo::ORG]; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Get the phone value. |
||
| 90 | */ |
||
| 91 | public function getPhone() |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Get the postal value. |
||
| 98 | */ |
||
| 99 | public function getPostal() |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Get the region value. |
||
| 106 | */ |
||
| 107 | public function getRegion() |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Get all the properties. |
||
| 114 | * |
||
| 115 | * @return array An associative array with all the properties. |
||
| 116 | */ |
||
| 117 | 1 | public function getProperties() |
|
| 121 | } |
||
| 122 |