Skip to content

Commit 52880cd

Browse files
committed
Cleanup
1 parent 2cdf606 commit 52880cd

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/GeoIP.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function getService()
202202

203203
// Sanity check
204204
if ($class === null) {
205-
throw new Exception('The GeoIP service is not valid.');
205+
throw new Exception('No GeoIP service is configured.');
206206
}
207207

208208
// Create service instance
@@ -237,6 +237,7 @@ public function getClientIP()
237237
'HTTP_FORWARDED_FOR',
238238
'HTTP_FORWARDED',
239239
'REMOTE_ADDR',
240+
'HTTP_X_FORWARDED_IP',
240241
'HTTP_X_CLUSTER_CLIENT_IP',
241242
];
242243

src/Location.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
* @property string|null $state
1717
* @property string|null $state_name
1818
* @property string|null $postal_code
19-
* @property float|null $lat
20-
* @property float|null $lon
19+
* @property float|null $lat
20+
* @property float|null $lon
2121
* @property string|null $timezone
2222
* @property string|null $continent
2323
* @property string|null $currency
24-
* @property bool $default
25-
* @property bool $cached
24+
* @property bool $default
25+
* @property bool $cached
2626
*
2727
* @package Torann\GeoIP
2828
*/
@@ -48,7 +48,7 @@ public function __construct(array $attributes = [])
4848
/**
4949
* Determine if the location is for the same IP address.
5050
*
51-
* @param string $ip
51+
* @param string $ip
5252
*
5353
* @return bool
5454
*/
@@ -60,8 +60,8 @@ public function same($ip)
6060
/**
6161
* Set a given attribute on the location.
6262
*
63-
* @param string $key
64-
* @param mixed $value
63+
* @param string $key
64+
* @param mixed $value
6565
*
6666
* @return $this
6767
*/
@@ -75,19 +75,19 @@ public function setAttribute($key, $value)
7575
/**
7676
* Get an attribute from the $attributes array.
7777
*
78-
* @param string $key
78+
* @param string $key
7979
*
8080
* @return mixed
8181
*/
8282
public function getAttribute($key)
8383
{
8484
$value = Arr::get($this->attributes, $key);
8585

86+
$method = 'get' . Str::studly($key) . 'Attribute';
87+
8688
// First we will check for the presence of a mutator for the set operation
8789
// which simply lets the developers tweak the attribute as it is set.
88-
if (method_exists($this, 'get' . Str::studly($key) . 'Attribute')) {
89-
$method = 'get' . Str::studly($key) . 'Attribute';
90-
90+
if (method_exists($this, $method)) {
9191
return $this->{$method}($value);
9292
}
9393

@@ -127,7 +127,7 @@ public function toArray()
127127
/**
128128
* Get the location's attribute
129129
*
130-
* @param string $key
130+
* @param string $key
131131
*
132132
* @return mixed
133133
*/
@@ -139,8 +139,8 @@ public function __get($key)
139139
/**
140140
* Set the location's attribute
141141
*
142-
* @param string $key
143-
* @param mixed $value
142+
* @param string $key
143+
* @param mixed $value
144144
*/
145145
public function __set($key, $value)
146146
{
@@ -150,7 +150,7 @@ public function __set($key, $value)
150150
/**
151151
* Determine if the given attribute exists.
152152
*
153-
* @param mixed $offset
153+
* @param mixed $offset
154154
*
155155
* @return bool
156156
*/
@@ -162,7 +162,7 @@ public function offsetExists(mixed $offset): bool
162162
/**
163163
* Get the value for a given offset.
164164
*
165-
* @param mixed $offset
165+
* @param mixed $offset
166166
*
167167
* @return mixed
168168
*/
@@ -174,8 +174,8 @@ public function offsetGet(mixed $offset): mixed
174174
/**
175175
* Set the value for a given offset.
176176
*
177-
* @param mixed $offset
178-
* @param mixed $value
177+
* @param mixed $offset
178+
* @param mixed $value
179179
*
180180
* @return void
181181
*/
@@ -187,7 +187,7 @@ public function offsetSet(mixed $offset, mixed $value): void
187187
/**
188188
* Unset the value for a given offset.
189189
*
190-
* @param mixed $offset
190+
* @param mixed $offset
191191
*
192192
* @return void
193193
*/
@@ -211,7 +211,7 @@ public function __isset($key)
211211
/**
212212
* Unset an attribute on the location.
213213
*
214-
* @param string $key
214+
* @param string $key
215215
*
216216
* @return void
217217
*/

0 commit comments

Comments
 (0)