refactor: code style changes
Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
@@ -23,7 +23,6 @@ namespace App\CustomFacades;
|
||||
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class IP
|
||||
{
|
||||
@@ -31,14 +30,14 @@ class IP
|
||||
// For views, this is in a service provider, and is shared with all of them
|
||||
/**
|
||||
* Determines whether you should collect/display IP addresses in the app.
|
||||
*
|
||||
* @return bool Whether you should collect/display IPs, in the context in which this is called
|
||||
*/
|
||||
public function shouldCollect(): bool
|
||||
{
|
||||
// should collect or display IPs?
|
||||
|
||||
if (config('demo.is_enabled') || config('app.hide_ips'))
|
||||
{
|
||||
if (config('demo.is_enabled') || config('app.hide_ips')) {
|
||||
return false; // do not collect!
|
||||
}
|
||||
|
||||
@@ -47,7 +46,8 @@ class IP
|
||||
|
||||
/**
|
||||
* Looks up information on a specified IP address. Caches results automatically.
|
||||
* @param string $IP IP address to lookup
|
||||
*
|
||||
* @param string $IP IP address to lookup
|
||||
* @return object
|
||||
*/
|
||||
public function lookup(string $IP): object
|
||||
@@ -58,19 +58,17 @@ class IP
|
||||
];
|
||||
|
||||
if ($this->shouldCollect()) {
|
||||
|
||||
|
||||
return json_decode(Cache::remember($IP, 3600, function () use ($IP) {
|
||||
return Http::get(config('general.urls.ipapi.ipcheck'), [
|
||||
'apiKey' => config('general.keys.ipapi.apikey'),
|
||||
'ip' => $IP,
|
||||
])->body();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
return new class {
|
||||
public $message = "This feature is disabled.";
|
||||
return new class
|
||||
{
|
||||
public $message = 'This feature is disabled.';
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user