Skip to content

Commit 3c334cb

Browse files
Merge pull request antonioribeiro#53 from antonioribeiro/analysis-q1vL41
Apply fixes from StyleCI [ci skip] [skip ci]
2 parents b0e846b + f0295c8 commit 3c334cb

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/package/Support/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Base
88
{
99
/**
10-
* Console command
10+
* Console command.
1111
*
1212
* @var \Illuminate\Console\Command
1313
*/
@@ -137,14 +137,13 @@ private function loadFile($file)
137137
*/
138138
protected function makeJsonFileName($key, $dir = '')
139139
{
140-
if (!ends_with(DIRECTORY_SEPARATOR, $dir)) {
140+
if (! ends_with(DIRECTORY_SEPARATOR, $dir)) {
141141
$dir .= DIRECTORY_SEPARATOR;
142142
}
143143

144144
return $this->dataDir(_dir($dir).strtolower($key).'.json');
145145
}
146146

147-
148147
/**
149148
* Put contents into a file.
150149
*
@@ -202,6 +201,7 @@ public function getHomeDir()
202201
{
203202
return getClassDir(Service::class);
204203
}
204+
205205
/**
206206
* Get a cached value.
207207
*

src/package/Support/UpdateData.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private function eraseDataDir($dir)
6767

6868
/**
6969
* Generate json files from array.
70-
* s
70+
* s.
7171
* @param $result
7272
* @param $dir
7373
* @param Closure $makeGroupKeyClosure
@@ -78,14 +78,14 @@ private function generateJsonFiles($result, $dir, $makeGroupKeyClosure)
7878
$count2 = 0;
7979

8080
$count1 = countriesCollect($result)->map(function ($item) {
81-
return $this->normalize(countriesCollect($item)->mapWithKeys(function($value, $key) {
81+
return $this->normalize(countriesCollect($item)->mapWithKeys(function ($value, $key) {
8282
return [strtolower($key) => $value];
8383
}));
8484
})->groupBy('grouping')->each(function ($item, $key) use ($dir, $makeGroupKeyClosure, &$count2) {
8585
$this->mkdir(dirname($file = $this->makeJsonFileName($key, $dir)));
8686

8787
$item = $item->mapWithKeys(function ($item) use ($makeGroupKeyClosure) {
88-
return [$makeGroupKeyClosure($item) => countriesCollect($item)->sortBy(function($value, $key) {
88+
return [$makeGroupKeyClosure($item) => countriesCollect($item)->sortBy(function ($value, $key) {
8989
return $key;
9090
})];
9191
})->sortBy(function ($value, $key) {
@@ -188,7 +188,7 @@ public function updateCities()
188188

189189
$result = $this->loadShapeFile('natural_earth/ne_10m_populated_places');
190190

191-
list($countries, $cities) = $this->generateJsonFiles($result, $dataDir, function($item) {
191+
list($countries, $cities) = $this->generateJsonFiles($result, $dataDir, function ($item) {
192192
return snake_case(strtolower($item['nameascii']));
193193
});
194194

@@ -221,7 +221,7 @@ public function updateCountries()
221221
* @param \PragmaRX\Countries\Package\Support\Collection $country2
222222
* @return mixed
223223
*/
224-
function mergeCountries($country1, $country2)
224+
public function mergeCountries($country1, $country2)
225225
{
226226
if (is_null($country2)) {
227227
return $country1;
@@ -237,7 +237,7 @@ function mergeCountries($country1, $country2)
237237
}
238238

239239
if ($got !== $value) {
240-
$country2[$key . '_nev'] = $value; // Natural Earth Vector
240+
$country2[$key.'_nev'] = $value; // Natural Earth Vector
241241
}
242242
}
243243

@@ -257,7 +257,7 @@ public function updateStates()
257257

258258
$result = $this->loadShapeFile('natural_earth/ne_10m_admin_1_states_provinces');
259259

260-
list($countries, $states) = $this->generateJsonFiles($result, $dataDir, function($item) {
260+
list($countries, $states) = $this->generateJsonFiles($result, $dataDir, function ($item) {
261261
return $this->makeStatePostalCode($item);
262262
});
263263

src/package/Support/helpers.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ function load_shapefile($dir)
143143

144144
unset($shapeRecords);
145145

146-
return countriesCollect($result)->mapWithKeys(function($fields, $key1) {
146+
return countriesCollect($result)->mapWithKeys(function ($fields, $key1) {
147147
return [
148-
strtolower($key1) => countriesCollect($fields)->mapWithKeys(function($value, $key2) {
148+
strtolower($key1) => countriesCollect($fields)->mapWithKeys(function ($value, $key2) {
149149
return [strtolower($key2) => $value];
150-
})
150+
}),
151151
];
152152
});
153153
}
154154
}
155-

0 commit comments

Comments
 (0)