1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Bouncer package. |
5
|
|
|
* |
6
|
|
|
* (c) François Hodierne <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Bouncer\Resource; |
13
|
|
|
|
14
|
|
|
use Bouncer\Bouncer; |
15
|
|
|
use Bouncer\Resource; |
16
|
|
|
|
17
|
|
|
class Address extends Resource |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
protected $id; |
21
|
|
|
|
22
|
|
|
protected $value; |
23
|
|
|
|
24
|
|
|
protected $hostname; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param array|string $attributes |
28
|
|
|
*/ |
29
|
|
|
public function __construct($attributes = null) |
30
|
|
|
{ |
31
|
|
|
if (is_string($attributes)) { |
32
|
|
|
$this->setValue($attributes); |
33
|
|
|
} elseif (is_array($attributes)) { |
34
|
|
|
parent::__construct($attributes); |
35
|
|
|
} |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function getId() |
39
|
|
|
{ |
40
|
|
|
return $this->id; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function setId($id) |
44
|
|
|
{ |
45
|
|
|
$this->id = $id; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getValue() |
49
|
|
|
{ |
50
|
|
|
return $this->value; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function setValue($value) |
54
|
|
|
{ |
55
|
|
|
$this->value = $value; |
56
|
|
|
$this->id = Bouncer::hash($this->value); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getHostname() |
60
|
|
|
{ |
61
|
|
|
return $this->hostname; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setHostname($hostname) |
65
|
|
|
{ |
66
|
|
|
$this->hostname = $hostname; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getReverse() |
70
|
|
|
{ |
71
|
|
|
return $this->getAttribute('reverse'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getAsNumber() |
75
|
|
|
{ |
76
|
|
|
return $this->getAttribute('as_number'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getNetworkName() |
80
|
|
|
{ |
81
|
|
|
return $this->getAttribute('network_name'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getCountryCode() |
85
|
|
|
{ |
86
|
|
|
return $this->getAttribute('country_code'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getFlags() |
90
|
|
|
{ |
91
|
|
|
return $this->getAttribute('flags'); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
} |
95
|
|
|
|