diff --git a/src/Location.php b/src/Location.php index 8f9765f..7869e68 100644 --- a/src/Location.php +++ b/src/Location.php @@ -150,7 +150,7 @@ public function lists($value = '', $name = '') { $countries = $this->getCountryCodes(); - $list = array(); + $list = []; /* * If no value or name set, grab the default dropdown config values @@ -436,7 +436,7 @@ private function getSelectedDriver() */ private function getDriverFallbackList() { - return $this->config->get('location'. $this->getConfigSeparator() .'selected_driver_fallbacks', array()); + return $this->config->get('location'. $this->getConfigSeparator() .'selected_driver_fallbacks', []); } /** diff --git a/src/LocationServiceProvider.php b/src/LocationServiceProvider.php index 191cddc..449964f 100644 --- a/src/LocationServiceProvider.php +++ b/src/LocationServiceProvider.php @@ -45,6 +45,6 @@ public function register() */ public function provides() { - return array('location'); + return ['location']; } } diff --git a/src/config/config.php b/src/config/config.php index f976fd9..26eee53 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -1,6 +1,6 @@ array( - 'FreeGeoIp' => array( + 'drivers' => [ + 'FreeGeoIp' => [ 'url' => 'http://freegeoip.net/json/', - ), + ], - 'GeoPlugin' => array( + 'GeoPlugin' => [ 'url' => 'http://www.geoplugin.net/php.gp?ip=', - ), + ], - 'IpInfo' => array( + 'IpInfo' => [ 'url' => 'http://ipinfo.io/', - ), + ], - 'Telize' => array( + 'Telize' => [ 'url' => 'http://www.telize.com/geoip/', - ), + ], - 'MaxMind' => array( - 'configuration' => array( + 'MaxMind' => [ + 'configuration' => [ 'web_service' => false, //If set to true, you must fill in your user ID and license key 'user_id' => '', 'license_key' => '' - ), - ), - ), + ], + ], + ], /* * Override if you want to provide your own drivers @@ -51,11 +51,11 @@ * Selected Driver Fallbacks: * The drivers you want to use to grab location if the selected driver is unavailable (in order) */ - 'selected_driver_fallbacks' => array( + 'selected_driver_fallbacks' => [ 'IpInfo', 'GeoPlugin', 'MaxMind', - ), + ], /* * If your running your website locally and want to test different @@ -79,18 +79,18 @@ * Value is the value of the selected item in the dropdown * Name is the appearance of the selected item */ - 'dropdown_config' => array( + 'dropdown_config' => [ /* * Only options at the moment are 'country_code', or 'country_name' */ 'value' => 'country_code', 'name' => 'country_name', - ), + ], /** Country Codes: * Country codes are in use only for dropdown at the moment **/ - 'country_codes' => array( + 'country_codes' => [ 'AF' => 'Afghanistan', 'AX' => 'Aland Islands', 'AL' => 'Albania', @@ -336,5 +336,5 @@ 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe', - ), -); + ], +]; diff --git a/tests/LocationTest.php b/tests/LocationTest.php index 55e4b60..661d6a7 100644 --- a/tests/LocationTest.php +++ b/tests/LocationTest.php @@ -28,12 +28,12 @@ protected function setUp() public function testLocationDriverFreeGeoIp() { - $this->config->shouldReceive('get')->andReturnValues(array( + $this->config->shouldReceive('get')->andReturnValues([ 'FreeGeoIp', 'Stevebauman\Location\Drivers\\', 'http://freegeoip.net/json/', '66.102.0.0' - )); + ]); $this->location = new Location($this->app, $this->config, $this->session); @@ -51,12 +51,12 @@ public function testLocationDriverFreeGeoIp() public function testLocationDriverGeoPlugin() { - $this->config->shouldReceive('get')->andReturnValues(array( + $this->config->shouldReceive('get')->andReturnValues([ 'GeoPlugin', 'Stevebauman\Location\Drivers\\', 'http://www.geoplugin.net/php.gp?ip=', '66.102.0.0' - )); + ]); $this->location = new Location($this->app, $this->config, $this->session); @@ -74,12 +74,12 @@ public function testLocationDriverGeoPlugin() public function testLocationDriverIpInfo() { - $this->config->shouldReceive('get')->andReturnValues(array( + $this->config->shouldReceive('get')->andReturnValues([ 'IpInfo', 'Stevebauman\Location\Drivers\\', 'http://ipinfo.io/', '66.102.0.0' - )); + ]); $this->location = new Location($this->app, $this->config, $this->session); @@ -97,12 +97,12 @@ public function testLocationDriverIpInfo() public function testLocationDriverTelize() { - $this->config->shouldReceive('get')->andReturnValues(array( + $this->config->shouldReceive('get')->andReturnValues([ 'Telize', 'Stevebauman\Location\Drivers\\', 'http://www.telize.com/geoip/', '66.102.0.0' - )); + ]); $this->location = new Location($this->app, $this->config, $this->session); @@ -120,10 +120,10 @@ public function testLocationDriverTelize() public function testLocationDriverNotFoundException() { - $this->config->shouldReceive('get')->andReturnValues(array( + $this->config->shouldReceive('get')->andReturnValues([ 'test', 'test', - )); + ]); $this->setExpectedException('Stevebauman\Location\Exceptions\DriverDoesNotExistException');