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 | 1 | public function getCountry() |
|
55 | |||
56 | /** |
||
57 | * Get the hostname value. |
||
58 | */ |
||
59 | 1 | public function getHostname() |
|
63 | |||
64 | /** |
||
65 | * Get the ip value. |
||
66 | */ |
||
67 | 1 | public function getIp() |
|
71 | |||
72 | /** |
||
73 | * Get the loc value. |
||
74 | */ |
||
75 | 1 | public function getLoc() |
|
79 | |||
80 | /** |
||
81 | * Get the org value. |
||
82 | */ |
||
83 | 1 | public function getOrg() |
|
87 | |||
88 | /** |
||
89 | * Get the phone value. |
||
90 | */ |
||
91 | 1 | public function getPhone() |
|
92 | { |
||
93 | 1 | return $this->properties[Ipinfo::PHONE]; |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * Get the postal value. |
||
98 | */ |
||
99 | 1 | public function getPostal() |
|
100 | { |
||
101 | 1 | return $this->properties[Ipinfo::POSTAL]; |
|
102 | } |
||
103 | |||
104 | /** |
||
105 | * Get the region value. |
||
106 | */ |
||
107 | 1 | public function getRegion() |
|
108 | { |
||
109 | 1 | return $this->properties[Ipinfo::REGION]; |
|
110 | } |
||
111 | |||
112 | /** |
||
113 | * Get all the properties. |
||
114 | * |
||
115 | * @return array An associative array with all the properties. |
||
116 | */ |
||
117 | 2 | public function getProperties() |
|
121 | } |
||
122 |