Skip to content

Commit

Permalink
Changed all arrays to short array syntax for more PSR compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Apr 24, 2015
1 parent 9582a52 commit 6580270
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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', []);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/LocationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function register()
*/
public function provides()
{
return array('location');
return ['location'];
}
}
44 changes: 22 additions & 22 deletions src/config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return array(
return [

/*
* Available drivers (must be spelt exact):
Expand All @@ -10,31 +10,31 @@
* Telize (Recommended)
* MaxMind
*/
'drivers' => 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
Expand All @@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -336,5 +336,5 @@
'YE' => 'Yemen',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
),
);
],
];
20 changes: 10 additions & 10 deletions tests/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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');

Expand Down

0 comments on commit 6580270

Please sign in to comment.