dependencies-upgrade
This commit is contained in:
11
vendor/torann/geoip/composer.json
vendored
11
vendor/torann/geoip/composer.json
vendored
@@ -18,9 +18,10 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"illuminate/support": "^6.0|^7.0",
|
||||
"illuminate/console": "^6.0|^7.0"
|
||||
"php": "^7.2 || ^8.0",
|
||||
"illuminate/support": "^8.0",
|
||||
"illuminate/console": "^8.0",
|
||||
"illuminate/cache": "^8.0"
|
||||
},
|
||||
"suggest": {
|
||||
"geoip2/geoip2": "Required to use the MaxMind database or web service with GeoIP (~2.1).",
|
||||
@@ -30,7 +31,9 @@
|
||||
"phpunit/phpunit": "^8.0",
|
||||
"mockery/mockery": "^1.3",
|
||||
"geoip2/geoip2": "~2.1",
|
||||
"vlucas/phpdotenv": "^4.0"
|
||||
"vlucas/phpdotenv": "^5.0",
|
||||
"phpstan/phpstan": "^0.12.14",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
||||
26
vendor/torann/geoip/phpcs.xml
vendored
Normal file
26
vendor/torann/geoip/phpcs.xml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="PSR2-package">
|
||||
<description>The PSR2 standard</description>
|
||||
|
||||
<!-- use preg_match https://github.com/squizlabs/PHP_CodeSniffer/issues/742#issuecomment-215250517 -->
|
||||
<exclude-pattern>/resources/</exclude-pattern>
|
||||
<exclude-pattern>/vendor/</exclude-pattern>
|
||||
<exclude-pattern>/_[a-zA-Z0-9\._]+\.php</exclude-pattern>
|
||||
<exclude-pattern>/\.[a-zA-Z0-9\._]+\.php</exclude-pattern>
|
||||
<exclude-pattern>\.git</exclude-pattern>
|
||||
|
||||
<!-- Include the whole PSR2 standard -->
|
||||
<rule ref="PSR2">
|
||||
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
|
||||
<exclude name="PSR2.Files.EndFileNewline"/>
|
||||
<exclude name="PSR2.Methods.FunctionCallSignature.MultipleArguments"/>
|
||||
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/>
|
||||
</rule>
|
||||
|
||||
<!-- Lines can be longer -->
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<properties>
|
||||
<property name="lineLimit" value="9999"/>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
||||
10
vendor/torann/geoip/phpstan.neon
vendored
Normal file
10
vendor/torann/geoip/phpstan.neon
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
parameters:
|
||||
excludes_analyse:
|
||||
- vendor
|
||||
- resources
|
||||
ignoreErrors:
|
||||
- '#Function config_path not found#'
|
||||
- '#Function config not found#'
|
||||
- '#Instantiated class Monolog\\Logger not found#'
|
||||
- '#Instantiated class Monolog\\Handler\\StreamHandler not found#'
|
||||
- '#Access to constant ERROR on an unknown class Monolog\\Logger#'
|
||||
19
vendor/torann/geoip/src/GeoIP.php
vendored
19
vendor/torann/geoip/src/GeoIP.php
vendored
@@ -107,6 +107,7 @@ class GeoIP
|
||||
* @param string $ip
|
||||
*
|
||||
* @return \Torann\GeoIP\Location
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getLocation($ip = null)
|
||||
{
|
||||
@@ -114,7 +115,7 @@ class GeoIP
|
||||
$this->location = $this->find($ip);
|
||||
|
||||
// Should cache location
|
||||
if ($this->shouldCache($ip, $this->location)) {
|
||||
if ($this->shouldCache($this->location, $ip)) {
|
||||
$this->getCache()->set($ip, $this->location);
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ class GeoIP
|
||||
$location = $this->getService()->locate($ip);
|
||||
|
||||
// Set currency if not already set by the service
|
||||
if (!$location->currency) {
|
||||
if (! $location->currency) {
|
||||
$location->currency = $this->getCurrency($location->iso_code);
|
||||
}
|
||||
|
||||
@@ -156,8 +157,7 @@ class GeoIP
|
||||
$location->default = false;
|
||||
|
||||
return $location;
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
if ($this->config('log_failures', true) === true) {
|
||||
$log = new Logger('geoip');
|
||||
$log->pushHandler(new StreamHandler(storage_path('logs/geoip.log'), Logger::ERROR));
|
||||
@@ -262,8 +262,8 @@ class GeoIP
|
||||
*/
|
||||
private function isValid($ip)
|
||||
{
|
||||
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)
|
||||
&& !filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE)
|
||||
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)
|
||||
&& ! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -274,12 +274,12 @@ class GeoIP
|
||||
/**
|
||||
* Determine if the location should be cached.
|
||||
*
|
||||
* @param string $ip
|
||||
* @param Location $location
|
||||
* @param Location $location
|
||||
* @param string|null $ip
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldCache($ip = null, Location $location)
|
||||
private function shouldCache(Location $location, $ip = null)
|
||||
{
|
||||
if ($location->default === true || $location->cached === true) {
|
||||
return false;
|
||||
@@ -287,7 +287,6 @@ class GeoIP
|
||||
|
||||
switch ($this->config('cache', 'none')) {
|
||||
case 'all':
|
||||
return true;
|
||||
case 'some' && $ip === null:
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,5 @@ class IPGeoLocation extends AbstractService
|
||||
$json = json_decode($data[0], true);
|
||||
|
||||
return $this->hydrate($json);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user