Skip to content

Commit 099689f

Browse files
Merge pull request #11 from ARCANEDEV/patch-1
Updating the package
2 parents a0e1dee + 23c7629 commit 099689f

14 files changed

+86
-83
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/vendor/
33
/composer.lock
44
/composer.phar
5+
/phpunit.xml

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ checks:
2222
tools:
2323
external_code_coverage:
2424
timeout: 600
25-
runs: 2
25+
runs: 3
2626
php_code_sniffer:
2727
enabled: true
2828
config:

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ sudo: false
55
php:
66
- 7.0
77
- 7.1
8+
- 7.2
89
- nightly
910

1011
matrix:
1112
allow_failures:
1213
- php: nightly
1314

14-
env:
15-
- TESTBENCH_VERSION=3.5.*
16-
1715
before_script:
1816
- travis_retry composer self-update
19-
- travis_retry composer require --prefer-source --no-interaction --dev "orchestra/testbench:${TESTBENCH_VERSION}"
17+
- travis_retry composer install --prefer-source --no-interaction
2018

2119
script:
2220
- composer validate

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2017 ARCANEDEV <arcanedev.maroc@gmail.com> - GeoIP
3+
Copyright (c) 2015-2018 ARCANEDEV <arcanedev.maroc@gmail.com> - GeoIP
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
],
1515
"require": {
1616
"php": ">=7.0",
17-
"arcanedev/support": "~4.2",
17+
"arcanedev/support": "~4.2.0",
1818
"guzzlehttp/guzzle": "~6.0"
1919
},
2020
"require-dev": {
21-
"phpunit/phpcov": "~4.0",
22-
"phpunit/phpunit": "~6.0",
23-
"geoip2/geoip2": "~2.6"
21+
"orchestra/testbench": "~3.5.0",
22+
"phpunit/phpunit": "~6.0",
23+
"phpunit/phpcov": "~4.0",
24+
"geoip2/geoip2": "~2.6"
2425
},
2526
"autoload": {
2627
"psr-4": {
@@ -36,16 +37,10 @@
3637
"laravel": {
3738
"providers": [
3839
"Arcanedev\\GeoIP\\GeoIPServiceProvider"
39-
],
40-
"aliases": {
41-
"GeoIP": "Arcanedev\\GeoIP\\Facades\\GeoIP"
42-
}
40+
]
4341
}
4442
},
4543
"suggest": {
4644
"geoip2/geoip2": "Required if you're going to use the MaxMind database or web service."
47-
},
48-
"scripts": {
49-
"testbench": "composer require --dev \"orchestra/testbench=~3.5.0\""
5045
}
5146
}

config/geoip.php

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<?php
22

33
return [
4-
/* ------------------------------------------------------------------------------------------------
4+
5+
/* -----------------------------------------------------------------
56
| Default Driver
6-
| ------------------------------------------------------------------------------------------------
7+
| -----------------------------------------------------------------
78
| Supported: 'freegeoip', 'ip-api', 'maxmind-database', 'maxmind-api'
89
*/
10+
911
'default' => 'freegeoip',
1012

11-
/* ------------------------------------------------------------------------------------------------
13+
/* -----------------------------------------------------------------
1214
| Supported Drivers
13-
| ------------------------------------------------------------------------------------------------
15+
| -----------------------------------------------------------------
1416
*/
17+
1518
'supported' => [
1619
'freegeoip' => [
1720
'driver' => Arcanedev\GeoIP\Drivers\FreeGeoIpDriver::class,
@@ -47,10 +50,11 @@
4750
],
4851
],
4952

50-
/* ------------------------------------------------------------------------------------------------
53+
/* -----------------------------------------------------------------
5154
| Cache
52-
| ------------------------------------------------------------------------------------------------
55+
| -----------------------------------------------------------------
5356
*/
57+
5458
'cache' => [
5559
'mode' => 'all',
5660

@@ -59,20 +63,22 @@
5963
'expires' => 30,
6064
],
6165

62-
/* ------------------------------------------------------------------------------------------------
66+
/* -----------------------------------------------------------------
6367
| Log failures
64-
| ------------------------------------------------------------------------------------------------
68+
| -----------------------------------------------------------------
6569
*/
70+
6671
'log-failures' => [
6772
'enabled' => true,
6873

6974
'location' => storage_path('logs/geoip.log'),
7075
],
7176

72-
/* ------------------------------------------------------------------------------------------------
77+
/* -----------------------------------------------------------------
7378
| Entities
74-
| ------------------------------------------------------------------------------------------------
79+
| -----------------------------------------------------------------
7580
*/
81+
7682
'location' => [
7783
'default' => [
7884
'ip' => '',
@@ -90,10 +96,11 @@
9096
],
9197
],
9298

93-
/* ------------------------------------------------------------------------------------------------
99+
/* -----------------------------------------------------------------
94100
| Continents
95-
| ------------------------------------------------------------------------------------------------
101+
| -----------------------------------------------------------------
96102
*/
103+
97104
'continents' => [
98105
'A1' => '--',
99106
'A2' => '--',
@@ -349,10 +356,11 @@
349356
'ZW' => 'AF',
350357
],
351358

352-
/* ------------------------------------------------------------------------------------------------
359+
/* -----------------------------------------------------------------
353360
| Currencies
354-
| ------------------------------------------------------------------------------------------------
361+
| -----------------------------------------------------------------
355362
*/
363+
356364
'currencies' => [
357365
'included' => true,
358366

@@ -606,4 +614,5 @@
606614
'ZW' => 'ZWL',
607615
],
608616
],
617+
609618
];

tests/DriverManagerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ public function it_can_be_instantiated()
5050
];
5151

5252
foreach ($expectations as $expected) {
53-
$this->assertInstanceOf($expected, $this->manager);
53+
static::assertInstanceOf($expected, $this->manager);
5454
}
5555
}
5656

5757
/** @test */
5858
public function it_can_get_default_driver()
5959
{
60-
$this->assertInstanceOf(
60+
static::assertInstanceOf(
6161
\Arcanedev\GeoIP\Drivers\FreeGeoIpDriver::class,
6262
$this->manager->driver()
6363
);
@@ -74,7 +74,7 @@ public function it_can_get_driver_by_name()
7474
];
7575

7676
foreach ($drivers as $name => $driver) {
77-
$this->assertInstanceOf($driver, $this->manager->driver($name));
77+
static::assertInstanceOf($driver, $this->manager->driver($name));
7878
}
7979
}
8080
}

tests/Drivers/FreeGeoIpDriverTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function it_can_be_instantiated()
5353
];
5454

5555
foreach ($expectations as $expected) {
56-
$this->assertInstanceOf($expected, $this->driver);
56+
static::assertInstanceOf($expected, $this->driver);
5757
}
5858
}
5959

@@ -62,7 +62,7 @@ public function it_can_locate()
6262
{
6363
$location = $this->driver->locate('128.101.101.101');
6464

65-
$this->assertInstanceOf(\Arcanedev\GeoIP\Location::class, $location);
65+
static::assertInstanceOf(\Arcanedev\GeoIP\Location::class, $location);
6666

6767
$expected = [
6868
'ip' => '128.101.101.101',
@@ -78,10 +78,10 @@ public function it_can_locate()
7878
'continent' => 'NA',
7979
];
8080

81-
$this->assertSame($expected, $location->attributes());
82-
$this->assertSame($expected, $location->toArray());
81+
static::assertSame($expected, $location->attributes());
82+
static::assertSame($expected, $location->toArray());
8383

84-
$this->assertFalse($location->default);
85-
$this->assertSame($expected['city'].', '.$expected['state_code'], $location->display_name);
84+
static::assertFalse($location->default);
85+
static::assertSame($expected['city'].', '.$expected['state_code'], $location->display_name);
8686
}
8787
}

tests/Drivers/IpApiDriverTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function it_can_be_instantiated()
5353
];
5454

5555
foreach ($expectations as $expected) {
56-
$this->assertInstanceOf($expected, $this->driver);
56+
static::assertInstanceOf($expected, $this->driver);
5757
}
5858
}
5959

@@ -62,26 +62,26 @@ public function it_can_locate()
6262
{
6363
$location = $this->driver->locate('128.101.101.101');
6464

65-
$this->assertInstanceOf(\Arcanedev\GeoIP\Location::class, $location);
65+
static::assertInstanceOf(\Arcanedev\GeoIP\Location::class, $location);
6666

6767
$expected = [
6868
'ip' => '128.101.101.101',
6969
'iso_code' => 'US',
7070
'country' => 'United States',
71-
'city' => 'Minneapolis',
71+
'city' => 'Saint Paul',
7272
'state' => 'Minnesota',
7373
'state_code' => 'MN',
74-
'postal_code' => '55414',
75-
'latitude' => 44.9759,
76-
'longitude' => -93.2166,
74+
'postal_code' => '55102',
75+
'latitude' => 44.9278,
76+
'longitude' => -93.1162,
7777
'timezone' => 'America/Chicago',
7878
'continent' => 'NA',
7979
];
8080

81-
$this->assertSame($expected, $location->attributes());
82-
$this->assertSame($expected, $location->toArray());
81+
static::assertSame($expected, $location->attributes());
82+
static::assertSame($expected, $location->toArray());
8383

84-
$this->assertFalse($location->default);
85-
$this->assertSame($expected['city'].', '.$expected['state_code'], $location->display_name);
84+
static::assertFalse($location->default);
85+
static::assertSame($expected['city'].', '.$expected['state_code'], $location->display_name);
8686
}
8787
}

tests/Drivers/MaxmindDatabaseDriverTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MaxmindDatabaseDriverTest extends TestCase
1818
/** @test */
1919
public function it_can_be_instantiated()
2020
{
21-
$this->assertInstanceOf(
21+
static::assertInstanceOf(
2222
\Arcanedev\GeoIP\Drivers\MaxmindDatabaseDriver::class,
2323
$this->makeDriver()
2424
);
@@ -31,7 +31,7 @@ public function it_can_locate()
3131

3232
$location = $this->makeDriver()->locate('128.101.101.101');
3333

34-
$this->assertInstanceOf(\Arcanedev\GeoIP\Location::class, $location);
34+
static::assertInstanceOf(\Arcanedev\GeoIP\Location::class, $location);
3535

3636
$expected = [
3737
'ip' => '128.101.101.101',
@@ -47,11 +47,11 @@ public function it_can_locate()
4747
'continent' => 'NA',
4848
];
4949

50-
$this->assertSame($expected, $location->attributes());
51-
$this->assertSame($expected, $location->toArray());
50+
static::assertSame($expected, $location->attributes());
51+
static::assertSame($expected, $location->toArray());
5252

53-
$this->assertFalse($location->default);
54-
$this->assertSame($expected['city'].', '.$expected['state_code'], $location->display_name);
53+
static::assertFalse($location->default);
54+
static::assertSame($expected['city'].', '.$expected['state_code'], $location->display_name);
5555
}
5656

5757
/**

0 commit comments

Comments
 (0)