laravel-6 support
This commit is contained in:
22
vendor/torann/geoip/src/Location.php
vendored
22
vendor/torann/geoip/src/Location.php
vendored
@@ -6,6 +6,26 @@ use ArrayAccess;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
/**
|
||||
* Class Location
|
||||
*
|
||||
* @property string|null $ip
|
||||
* @property string|null $iso_code
|
||||
* @property string|null $country
|
||||
* @property string|null $city
|
||||
* @property string|null $state
|
||||
* @property string|null $state_name
|
||||
* @property string|null $postal_code
|
||||
* @property float|null $lat
|
||||
* @property float|null $lon
|
||||
* @property string|null $timezone
|
||||
* @property string|null $continent
|
||||
* @property string|null $currency
|
||||
* @property bool $default
|
||||
* @property bool $cached
|
||||
*
|
||||
* @package Torann\GeoIP
|
||||
*/
|
||||
class Location implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
@@ -199,4 +219,4 @@ class Location implements ArrayAccess
|
||||
{
|
||||
unset($this->attributes[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,17 @@ class MaxMindDatabase extends AbstractService
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$path = $this->config('database_path');
|
||||
|
||||
// Copy test database for now
|
||||
if (file_exists($this->config('database_path')) === false) {
|
||||
copy(__DIR__ . '/../../resources/geoip.mmdb', $this->config('database_path'));
|
||||
if (is_file($path) === false) {
|
||||
@mkdir(dirname($path));
|
||||
|
||||
copy(__DIR__ . '/../../resources/geoip.mmdb', $path);
|
||||
}
|
||||
|
||||
$this->reader = new Reader(
|
||||
$this->config('database_path'),
|
||||
$this->config('locales', ['en'])
|
||||
$path, $this->config('locales', ['en'])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,7 +93,8 @@ class MaxMindDatabase extends AbstractService
|
||||
* Provide a temporary directory to perform operations in and and ensure
|
||||
* it is removed afterwards.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable $callback
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function withTemporaryDirectory(callable $callback)
|
||||
@@ -113,7 +117,8 @@ class MaxMindDatabase extends AbstractService
|
||||
/**
|
||||
* Recursively search the given archive to find the .mmdb file.
|
||||
*
|
||||
* @param \PharData $archive
|
||||
* @param \PharData $archive
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
@@ -135,16 +140,17 @@ class MaxMindDatabase extends AbstractService
|
||||
/**
|
||||
* Recursively delete the given directory.
|
||||
*
|
||||
* @param string $directory
|
||||
* @param string $directory
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function deleteDirectory(string $directory)
|
||||
{
|
||||
if (!file_exists($directory)) {
|
||||
if (! file_exists($directory)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!is_dir($directory)) {
|
||||
if (! is_dir($directory)) {
|
||||
return unlink($directory);
|
||||
}
|
||||
|
||||
@@ -153,7 +159,7 @@ class MaxMindDatabase extends AbstractService
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$this->deleteDirectory($directory . DIRECTORY_SEPARATOR . $item)) {
|
||||
if (! $this->deleteDirectory($directory . DIRECTORY_SEPARATOR . $item)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user