Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -1,4 +1,5 @@
/vendor
composer.phar
composer.lock
.DS_Store
.DS_Store
.idea/*

View File

@@ -4,7 +4,6 @@ php:
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
allow_failures:
@@ -14,4 +13,4 @@ before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev
script: phpunit
script: phpunit

View File

@@ -11,7 +11,7 @@
"IP API",
"infoDB"
],
"license": "BSD 2-Clause",
"license": "BSD-2-Clause",
"authors": [
{
"name": "Daniel Stainback",
@@ -20,8 +20,8 @@
],
"require": {
"php": ">=5.5.9",
"illuminate/support": "~5.0",
"illuminate/console": "~5.0"
"illuminate/support": "5.0.* || 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*",
"illuminate/console": "5.0.* || 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*"
},
"suggest": {
"geoip2/geoip2": "Required to use the MaxMind database or web service with GeoIP (~2.1).",
@@ -51,6 +51,14 @@
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"laravel": {
"providers": [
"Torann\\GeoIP\\GeoIPServiceProvider"
],
"aliases": {
"GeoIP": "Torann\\GeoIP\\Facades\\GeoIP"
}
}
}
}

View File

@@ -70,6 +70,7 @@ return [
'secure' => true,
'key' => env('IPAPI_KEY'),
'continent_path' => storage_path('app/continents.json'),
'lang' => 'en',
],
],
@@ -140,4 +141,4 @@ return [
'currency' => 'USD',
],
];
];

View File

@@ -20,8 +20,18 @@ class Clear extends Command
*/
protected $description = 'Clear GeoIP cached locations.';
/**
* Execute the console command for Laravel 5.5 and newer.
* @return void
*/
public function handle()
{
$this->fire();
}
/**
* Execute the console command.
* @return void
*/
public function fire()
{
@@ -40,7 +50,7 @@ class Clear extends Command
protected function isSupported()
{
return empty(app('geoip')->config('cache_tags')) === false
&& in_array(config('cache.default'), ['file', 'database']) === false;
&& in_array(config('cache.default'), ['file', 'database']) === false;
}
/**
@@ -56,4 +66,4 @@ class Clear extends Command
$this->output->writeln("<info>complete</info>");
}
}
}

View File

@@ -20,6 +20,15 @@ class Update extends Command
*/
protected $description = 'Update GeoIP database files to the latest version';
/**
* Execute the console command for Laravel 5.5 and newer.
* @return void
*/
public function handle()
{
$this->fire();
}
/**
* Execute the console command.
*
@@ -32,7 +41,7 @@ class Update extends Command
// Ensure the selected service supports updating
if (method_exists($service, 'update') === false) {
$this->info('The current service "' . get_class($service). '" does not support updating.');
$this->info('The current service "' . get_class($service) . '" does not support updating.');
return;
}
@@ -41,9 +50,8 @@ class Update extends Command
// Perform update
if ($result = $service->update()) {
$this->info($result);
}
else {
} else {
$this->error('Update failed!');
}
}
}
}

View File

@@ -131,6 +131,9 @@ class GeoIP
*/
private function find($ip = null)
{
// If IP not set, user remote IP
$ip = $ip ?: $this->remote_ip;
// Check cache for location
if ($this->config('cache', 'none') !== 'none' && $location = $this->getCache()->get($ip)) {
$location->cached = true;
@@ -138,9 +141,6 @@ class GeoIP
return $location;
}
// If IP not set, user remote IP
$ip = $ip ?: $this->remote_ip;
// Check if the ip is not local or empty
if ($this->isValid($ip)) {
try {
@@ -206,7 +206,7 @@ class GeoIP
}
// Create service instance
$this->service = app($class, [$config]);
$this->service = new $class($config);
}
return $this->service;

View File

@@ -37,7 +37,7 @@ class GeoIPServiceProvider extends ServiceProvider
}
/**
* Register currency resources.
* Register resources.
*
* @return void
*/
@@ -51,7 +51,7 @@ class GeoIPServiceProvider extends ServiceProvider
}
/**
* Register currency commands.
* Register commands.
*
* @return void
*/

View File

@@ -36,6 +36,7 @@ class IPApi extends AbstractService
],
'query' => [
'fields' => 49663,
'lang' => $this->config('lang', ['en']),
],
];
@@ -139,4 +140,4 @@ class IPApi extends AbstractService
{
return Arr::get($this->continents, $code, 'Unknown');
}
}
}

View File

@@ -35,7 +35,7 @@ return [
'BT' => 'BTN',
'BV' => 'NOK',
'BW' => 'BWP',
'BY' => 'BYR',
'BY' => 'BYN',
'BZ' => 'BZD',
'CA' => 'CAD',
'CC' => 'AUD',

View File

@@ -6,7 +6,7 @@ if (!function_exists('geoip')) {
*
* @param string $ip
*
* @return \Torann\GeoIP\GeoIP|string
* @return \Torann\GeoIP\GeoIP|\Torann\GeoIP\Location
*/
function geoip($ip = null)
{

View File

@@ -29,9 +29,7 @@ class GeoIPTest extends TestCase
$config = $this->getConfig()['services']['maxmind_database'];
unset($config['class']);
self::$functions->shouldReceive('app')->with('Torann\GeoIP\Services\MaxMindDatabase', [$config])->andReturn(true);
$this->assertEquals($geo_ip->getService(), true);
$this->assertInstanceOf(\Torann\GeoIP\Contracts\ServiceInterface::class, $geo_ip->getService());
}
/**

View File

@@ -39,7 +39,7 @@ class MaxMindDatabaseTest extends TestCase
try {
$location = $service->locate('1.1.1.1');
$this->assertEquals($location->default, 'Poop'); // This should never get a chance
$this->assertEquals($location->default, false);
}
catch (\GeoIp2\Exception\AddressNotFoundException $e) {
$this->assertEquals($e->getMessage(), 'The address 1.1.1.1 is not in the database.');
@@ -55,7 +55,7 @@ class MaxMindDatabaseTest extends TestCase
$this->assertEquals($service->update(), "Database file ({$config['database_path']}) updated.");
unlink($config['database_path']);
@unlink($config['database_path']);
}
protected function getService()

View File

@@ -3,9 +3,9 @@
namespace Torann\GeoIP\Tests;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
class TestCase extends PHPUnit_Framework_TestCase
class TestCase extends PHPUnitTestCase
{
public static $functions;