1 | <?php namespace Arcanedev\SpamBlocker\Entities; |
||
12 | class Spammer implements Arrayable, Jsonable |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Properties |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | /** @var string */ |
||
19 | protected $host; |
||
20 | |||
21 | /** @var bool */ |
||
22 | protected $blocked; |
||
23 | |||
24 | /* ------------------------------------------------------------------------------------------------ |
||
25 | | Constructor |
||
26 | | ------------------------------------------------------------------------------------------------ |
||
27 | */ |
||
28 | /** |
||
29 | * Spammer constructor. |
||
30 | * |
||
31 | * @param string $host |
||
32 | * @param bool $blocked |
||
33 | */ |
||
34 | 360 | public function __construct($host, $blocked) |
|
39 | |||
40 | /* ------------------------------------------------------------------------------------------------ |
||
41 | | Getters & Setters |
||
42 | | ------------------------------------------------------------------------------------------------ |
||
43 | */ |
||
44 | /** |
||
45 | * Get the host url. |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 351 | public function host() |
|
53 | |||
54 | /** |
||
55 | * Set the host url. |
||
56 | * |
||
57 | * @param string $host |
||
58 | * |
||
59 | * @return self |
||
60 | */ |
||
61 | 360 | public function setHost($host) |
|
67 | |||
68 | /** |
||
69 | * Get the blocked status. |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | 171 | public function isBlocked() |
|
77 | |||
78 | /** |
||
79 | * Set the blocked status. |
||
80 | * |
||
81 | * @param bool $blocked |
||
82 | * |
||
83 | * @return self |
||
84 | */ |
||
85 | 360 | public function setBlocked($blocked) |
|
91 | |||
92 | /* ------------------------------------------------------------------------------------------------ |
||
93 | | Main Functions |
||
94 | | ------------------------------------------------------------------------------------------------ |
||
95 | */ |
||
96 | /** |
||
97 | * Make a spammer instance. |
||
98 | * |
||
99 | * @param string $host |
||
100 | * @param bool $blocked |
||
101 | * |
||
102 | * @return self |
||
103 | */ |
||
104 | 324 | public static function make($host, $blocked = true) |
|
108 | |||
109 | /** |
||
110 | * Check if the given host is the same as the spammer host. |
||
111 | * |
||
112 | * @param string $host |
||
113 | * |
||
114 | * @return bool |
||
115 | */ |
||
116 | 9 | public function isSameHost($host) |
|
120 | |||
121 | /* ------------------------------------------------------------------------------------------------ |
||
122 | | Other Functions |
||
123 | | ------------------------------------------------------------------------------------------------ |
||
124 | */ |
||
125 | /** |
||
126 | * Get the instance as an array. |
||
127 | * |
||
128 | * @return array |
||
129 | */ |
||
130 | 18 | public function toArray() |
|
137 | |||
138 | /** |
||
139 | * Convert the object to its JSON representation. |
||
140 | * |
||
141 | * @param int $options |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | 9 | public function toJson($options = 0) |
|
149 | } |
||
150 |