Skip to content

Commit ecc35c1

Browse files
author
pulkit
committed
styleci fix
1 parent 2433e4b commit ecc35c1

14 files changed

+102
-88
lines changed

helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
if (!function_exists('gzdecode')) {
44
/**
5-
* gzdecode function
5+
* gzdecode function.
66
*/
77
function gzdecode($data)
88
{

scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ tools:
3131
excluded_dirs: [vendor, tests]
3232
php_cpd:
3333
enabled: true
34-
excluded_dirs: [vendor, tests]
34+
excluded_dirs: [vendor, tests]

src/Console/UpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace PulkitJalan\GeoIP\Console;
44

5-
use PulkitJalan\GeoIP\GeoIPUpdater;
65
use Illuminate\Console\Command;
6+
use PulkitJalan\GeoIP\GeoIPUpdater;
77

88
class UpdateCommand extends Command
99
{

src/Drivers/AbstractGeoIPDriver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ public function __construct(array $config)
2828
}
2929

3030
/**
31-
* Get GeoIP info from IP
31+
* Get GeoIP info from IP.
32+
*
33+
* @param string $ip
3234
*
33-
* @param string $ip
3435
* @return array
3536
*/
3637
abstract public function get($ip);

src/Drivers/IPApiDriver.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
class IPApiDriver extends AbstractGeoIPDriver
66
{
77
/**
8-
* Get array of data using ip-api
8+
* Get array of data using ip-api.
9+
*
10+
* @param string $ip
911
*
10-
* @param string $ip
1112
* @return array
1213
*/
1314
public function get($ip)
@@ -19,25 +20,26 @@ public function get($ip)
1920
}
2021

2122
return [
22-
'city' => array_get($data, 'city'),
23-
'country' => array_get($data, 'country'),
24-
'countryCode' => array_get($data, 'countryCode'),
25-
'latitude' => array_get($data, 'lat'),
26-
'longitude' => array_get($data, 'lon'),
27-
'region' => array_get($data, 'region'),
28-
'regionCode' => array_get($data, 'regionName'),
29-
'timezone' => array_get($data, 'timezone'),
30-
'postalCode' => array_get($data, 'zip'),
23+
'city' => array_get($data, 'city'),
24+
'country' => array_get($data, 'country'),
25+
'countryCode' => array_get($data, 'countryCode'),
26+
'latitude' => array_get($data, 'lat'),
27+
'longitude' => array_get($data, 'lon'),
28+
'region' => array_get($data, 'region'),
29+
'regionCode' => array_get($data, 'regionName'),
30+
'timezone' => array_get($data, 'timezone'),
31+
'postalCode' => array_get($data, 'zip'),
3132
'organization' => array_get($data, 'org'),
32-
'isp' => array_get($data, 'isp'),
33+
'isp' => array_get($data, 'isp'),
3334
];
3435
}
3536

3637
/**
3738
* Get the ip-api url add key and
38-
* change base url if pro user
39+
* change base url if pro user.
40+
*
41+
* @param string $ip
3942
*
40-
* @param string $ip
4143
* @return string
4244
*/
4345
protected function getUrl($ip)

src/Drivers/MaxmindDriver.php

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace PulkitJalan\GeoIP\Drivers;
44

5-
use PulkitJalan\GeoIP\Exceptions\InvalidCredentialsException;
6-
use PulkitJalan\GeoIP\Exceptions\InvalidDatabaseException;
5+
use GeoIp2\Database\Reader;
76
use GeoIp2\Exception\AddressNotFoundException;
87
use GeoIp2\WebService\Client;
9-
use GeoIp2\Database\Reader;
8+
use PulkitJalan\GeoIP\Exceptions\InvalidCredentialsException;
9+
use PulkitJalan\GeoIP\Exceptions\InvalidDatabaseException;
1010

1111
class MaxmindDriver extends AbstractGeoIPDriver
1212
{
@@ -26,9 +26,10 @@ public function __construct(array $config)
2626
}
2727

2828
/**
29-
* Get array of data using Maxmind
29+
* Get array of data using Maxmind.
30+
*
31+
* @param string $ip
3032
*
31-
* @param string $ip
3233
* @return array
3334
*/
3435
public function get($ip)
@@ -40,23 +41,24 @@ public function get($ip)
4041
}
4142

4243
return [
43-
'city' => $data->city->name,
44-
'country' => $data->country->name,
44+
'city' => $data->city->name,
45+
'country' => $data->country->name,
4546
'countryCode' => $data->country->isoCode,
46-
'latitude' => $data->location->latitude,
47-
'longitude' => $data->location->longitude,
48-
'region' => $data->mostSpecificSubdivision->name,
49-
'regionCode' => $data->mostSpecificSubdivision->isoCode,
50-
'timezone' => $data->location->timeZone,
51-
'postalCode' => $data->postal->code,
47+
'latitude' => $data->location->latitude,
48+
'longitude' => $data->location->longitude,
49+
'region' => $data->mostSpecificSubdivision->name,
50+
'regionCode' => $data->mostSpecificSubdivision->isoCode,
51+
'timezone' => $data->location->timeZone,
52+
'postalCode' => $data->postal->code,
5253
];
5354
}
5455

5556
/**
56-
* Create the maxmind driver based on config
57+
* Create the maxmind driver based on config.
5758
*
58-
* @return mixed
5959
* @throws \PulkitJalan\GeoIP\Exceptions\InvalidCredentialsException
60+
*
61+
* @return mixed
6062
*/
6163
protected function create()
6264
{
@@ -74,10 +76,11 @@ protected function create()
7476
}
7577

7678
/**
77-
* Create the maxmind web client
79+
* Create the maxmind web client.
7880
*
79-
* @return \GeoIp2\WebService\Client
8081
* @throws \PulkitJalan\GeoIP\Exceptions\InvalidCredentialsException
82+
*
83+
* @return \GeoIp2\WebService\Client
8184
*/
8285
protected function createWebClient()
8386
{
@@ -93,10 +96,11 @@ protected function createWebClient()
9396
}
9497

9598
/**
96-
* Create the maxmind database reader
99+
* Create the maxmind database reader.
97100
*
98-
* @return \GeoIp2\Database\Reader
99101
* @throws \PulkitJalan\GeoIP\Exceptions\InvalidCredentialsException
102+
*
103+
* @return \GeoIp2\Database\Reader
100104
*/
101105
protected function createDatabase()
102106
{

src/Drivers/TelizeDriver.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
class TelizeDriver extends AbstractGeoIPDriver
88
{
99
/**
10-
* Get array of data using telize
10+
* Get array of data using telize.
11+
*
12+
* @param string $ip
1113
*
12-
* @param string $ip
1314
* @return array
1415
*/
1516
public function get($ip)
@@ -21,23 +22,24 @@ public function get($ip)
2122
}
2223

2324
return [
24-
'city' => array_get($data, 'city'),
25-
'country' => array_get($data, 'country'),
25+
'city' => array_get($data, 'city'),
26+
'country' => array_get($data, 'country'),
2627
'countryCode' => array_get($data, 'country_code'),
27-
'latitude' => array_get($data, 'latitude'),
28-
'longitude' => array_get($data, 'longitude'),
29-
'region' => array_get($data, 'region'),
30-
'regionCode' => array_get($data, 'region_code'),
31-
'timezone' => array_get($data, 'timezone'),
32-
'postalCode' => array_get($data, 'postal_code'),
33-
'isp' => array_get($data, 'isp'),
28+
'latitude' => array_get($data, 'latitude'),
29+
'longitude' => array_get($data, 'longitude'),
30+
'region' => array_get($data, 'region'),
31+
'regionCode' => array_get($data, 'region_code'),
32+
'timezone' => array_get($data, 'timezone'),
33+
'postalCode' => array_get($data, 'postal_code'),
34+
'isp' => array_get($data, 'isp'),
3435
];
3536
}
3637

3738
/**
38-
* Get the telize url
39+
* Get the telize url.
40+
*
41+
* @param string $ip
3942
*
40-
* @param string $ip
4143
* @return string
4244
*/
4345
protected function getUrl($ip)

src/GeoIP.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class GeoIP
2222
protected $store = [];
2323

2424
/**
25-
* @var array $config
25+
* @var array
2626
*/
2727
public function __construct(array $config = ['driver' => 'ip-api'])
2828
{
2929
$this->driver = with(new GeoIPManager($config))->getDriver();
3030
}
3131

3232
/**
33-
* Getter for driver
33+
* Getter for driver.
3434
*
3535
* @return \PulkitJalan\GeoIP\Contracts\GeoIPInterface
3636
*/
@@ -40,9 +40,10 @@ public function getDriver()
4040
}
4141

4242
/**
43-
* Set ip
43+
* Set ip.
44+
*
45+
* @var string
4446
*
45-
* @var string $ip
4647
* @return PulkitJalan\GeoIP\GeoIP
4748
*/
4849
public function setIp($ip)
@@ -53,7 +54,7 @@ public function setIp($ip)
5354
}
5455

5556
/**
56-
* Get ip from server info
57+
* Get ip from server info.
5758
*
5859
* @return string ipaddress
5960
*/
@@ -64,9 +65,10 @@ public function getIp()
6465

6566
/**
6667
* Get an array or single item of geoip data
67-
* Also stores data in memory for further requests
68+
* Also stores data in memory for further requests.
69+
*
70+
* @param string $property
6871
*
69-
* @param string $property
7072
* @return array|string
7173
*/
7274
public function get($property = '')
@@ -81,10 +83,11 @@ public function get($property = '')
8183
}
8284

8385
/**
84-
* Get an array or single item of geoip data
86+
* Get an array or single item of geoip data.
8587
*
86-
* @return array
8788
* @throws \PulkitJalan\GeoIP\Exceptions\GeoIPException
89+
*
90+
* @return array
8891
*/
8992
protected function getData()
9093
{
@@ -108,12 +111,14 @@ protected function getData()
108111
}
109112

110113
/**
111-
* Magic call method for get*
114+
* Magic call method for get*.
115+
*
116+
* @param string $method
117+
* @param array $parameters
112118
*
113-
* @param string $method
114-
* @param array $parameters
115-
* @return mixed
116119
* @throws \BadMethodCallException
120+
*
121+
* @return mixed
117122
*/
118123
public function __call($method, $parameters)
119124
{

src/GeoIPManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace PulkitJalan\GeoIP;
44

5-
use PulkitJalan\GeoIP\Exceptions\InvalidDriverException;
5+
use PulkitJalan\GeoIP\Drivers\IPApiDriver;
66
use PulkitJalan\GeoIP\Drivers\MaxmindDriver;
77
use PulkitJalan\GeoIP\Drivers\TelizeDriver;
8-
use PulkitJalan\GeoIP\Drivers\IPApiDriver;
8+
use PulkitJalan\GeoIP\Exceptions\InvalidDriverException;
99

1010
class GeoIPManager
1111
{
@@ -23,7 +23,7 @@ public function __construct(array $config)
2323
}
2424

2525
/**
26-
* Get the driver based on config
26+
* Get the driver based on config.
2727
*
2828
* @return \PulkitJalan\GeoIP\AbstractGeoIPDriver
2929
*/
@@ -41,7 +41,7 @@ public function getDriver($driver = null)
4141
}
4242

4343
/**
44-
* Get the ip-api driver
44+
* Get the ip-api driver.
4545
*
4646
* @return \PulkitJalan\GeoIP\IPApiDriver
4747
*/
@@ -51,7 +51,7 @@ protected function createIpApiDriver(array $data)
5151
}
5252

5353
/**
54-
* Get the telize driver
54+
* Get the telize driver.
5555
*
5656
* @return \PulkitJalan\GeoIP\TelizeDriver
5757
*/
@@ -61,7 +61,7 @@ protected function createTelizeDriver(array $data)
6161
}
6262

6363
/**
64-
* Get the Maxmind driver
64+
* Get the Maxmind driver.
6565
*
6666
* @return \PulkitJalan\GeoIP\MaxmindDriver
6767
*/

src/GeoIPServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace PulkitJalan\GeoIP;
44

5-
use PulkitJalan\GeoIP\Console\UpdateCommand;
65
use Illuminate\Support\ServiceProvider;
6+
use PulkitJalan\GeoIP\Console\UpdateCommand;
77

88
class GeoIPServiceProvider extends ServiceProvider
99
{
@@ -39,7 +39,7 @@ public function register()
3939
}
4040

4141
/**
42-
* Register the main geoip wrapper
42+
* Register the main geoip wrapper.
4343
*
4444
* @return void
4545
*/
@@ -61,7 +61,7 @@ protected function registerUpdateCommand()
6161
return new UpdateCommand($app->config->get('geoip::config'));
6262
});
6363

64-
$this->commands(array('command.geoip.update'));
64+
$this->commands(['command.geoip.update']);
6565
}
6666

6767
/**

0 commit comments

Comments
 (0)