Passed
Push — test ( 7f1499...ccf3d3 )
by Someshwer
06:32
created
tests/TestLibrary.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $country = World::searchCountry('india');
31 31
 
32 32
         // Assert
33
-        $this->assertEquals(count($country) , 1);
33
+        $this->assertEquals(count($country), 1);
34 34
     }
35 35
 
36 36
     /** @test */
Please login to merge, or discard this patch.
src/Utils/Oceans.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     private function optimizeOceansData($all_oceans_data)
52 52
     {
53 53
         $str_length = strlen($all_oceans_data) - 4;
54
-        $all_oceans_trimmed_data = substr($all_oceans_data, 0, 2).substr($all_oceans_data, 3, $str_length);
54
+        $all_oceans_trimmed_data = substr($all_oceans_data, 0, 2) . substr($all_oceans_data, 3, $str_length);
55 55
         $hash = new Encrypter($this->en_key, $this->cipher);
56 56
 
57 57
         return $hash->decrypt($all_oceans_trimmed_data);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function formatOceans($oceans)
81 81
     {
82
-        return collect($oceans)->transform(function ($item) {
82
+        return collect($oceans)->transform(function($item) {
83 83
             $data['name'] = $item;
84 84
             $data['display_name'] = Str::title($item);
85 85
             $data['also_called_as'] = ($item == 'antarctic') ? 'Southern Ocean' : null;
Please login to merge, or discard this patch.
src/Utils/Wonders.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     private function optimizeWondersData($all_wonders_data)
47 47
     {
48 48
         $str_length = strlen($all_wonders_data) - 4;
49
-        $all_wonders_trimmed_data = substr($all_wonders_data, 0, 2).substr($all_wonders_data, 3, $str_length);
49
+        $all_wonders_trimmed_data = substr($all_wonders_data, 0, 2) . substr($all_wonders_data, 3, $str_length);
50 50
         $hash = new Encrypter($this->en_key, $this->cipher);
51 51
 
52 52
         return $hash->decrypt($all_wonders_trimmed_data);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function formatWonders($wonders)
76 76
     {
77
-        return collect($wonders)->transform(function ($item, $key) {
77
+        return collect($wonders)->transform(function($item, $key) {
78 78
             $data['name'] = $key;
79 79
             $data['display_name'] = str_replace('_', ' ', Str::title($key));
80 80
             $data['location'] = str_replace('_', ' ', Str::title($item));
Please login to merge, or discard this patch.
src/Utils/UnionTerritories.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     private function optimizeTerritoriesData($all_territories_data)
52 52
     {
53 53
         $str_length = strlen($all_territories_data) - 4;
54
-        $all_territories_trimmed_data = substr($all_territories_data, 0, 2).substr($all_territories_data, 3, $str_length);
54
+        $all_territories_trimmed_data = substr($all_territories_data, 0, 2) . substr($all_territories_data, 3, $str_length);
55 55
         $hash = new Encrypter($this->en_key, $this->cipher);
56 56
 
57 57
         return $hash->decrypt($all_territories_trimmed_data);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     private function formatTerritories($territories)
81 81
     {
82
-        return collect($territories)->transform(function ($item, $key) {
82
+        return collect($territories)->transform(function($item, $key) {
83 83
             $data['name'] = $key;
84 84
             $data['display_name'] = str_replace('_', ' ', Str::title($key));
85 85
             $data['capital'] = str_replace('_', ' ', Str::title($item));
Please login to merge, or discard this patch.
src/Utils/Continents.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     private function optimizeContinentsData($all_continents_data)
65 65
     {
66 66
         $str_length = strlen($all_continents_data) - 4;
67
-        $all_continents_trimmed_data = substr($all_continents_data, 0, 2).substr($all_continents_data, 3, $str_length);
67
+        $all_continents_trimmed_data = substr($all_continents_data, 0, 2) . substr($all_continents_data, 3, $str_length);
68 68
         // $hash = new Encrypter($this->en_key, Config::get('app.cipher'));
69 69
         $hash = new Encrypter($this->en_key, $this->cipher);
70 70
         $all_continents = $hash->decrypt($all_continents_trimmed_data);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     private function formatContinents($continents)
83 83
     {
84
-        return collect($continents)->transform(function ($item) {
84
+        return collect($continents)->transform(function($item) {
85 85
             $data['name'] = $item;
86 86
             $data['display_name'] = str_replace('_', ' ', Str::title($item));
87 87
             $data['also_called_as'] = ($item == 'australia') ? 'Oceania' : null;
Please login to merge, or discard this patch.
src/Lib/Countries.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     private function optimizeCountryData($all_countries_data)
53 53
     {
54 54
         $str_length = strlen($all_countries_data) - 4;
55
-        $all_countries_trimmed_data = substr($all_countries_data, 0, 2).substr($all_countries_data, 3, $str_length);
55
+        $all_countries_trimmed_data = substr($all_countries_data, 0, 2) . substr($all_countries_data, 3, $str_length);
56 56
         // $hash = new Encrypter($this->en_key, Config::get('app.cipher'));
57 57
         $hash = new Encrypter($this->en_key, $this->cipher);
58 58
         $all_countries = $hash->decrypt($all_countries_trimmed_data);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $all_countries_data = $this->data->countries();
71 71
         $all_countries = $this->optimizeCountryData($all_countries_data);
72
-        $countries = collect($all_countries)->map(function ($item) {
72
+        $countries = collect($all_countries)->map(function($item) {
73 73
             // return Str::title(str_replace('-',' ', $item));
74 74
             return Str::studly($item);
75 75
         });
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
         $all_countries_data = $this->data->countries();
90 90
         $all_countries = $this->optimizeCountryData($all_countries_data);
91 91
         if ($search_string == null) {
92
-            return array_map(function ($it) {
92
+            return array_map(function($it) {
93 93
                 return Str::studly($it);
94 94
             }, $all_countries);
95 95
         }
96
-        $countries = array_map(function ($it) {
96
+        $countries = array_map(function($it) {
97 97
             return Str::studly($it);
98
-        }, array_filter($all_countries, function ($item) use ($search_string) {
98
+        }, array_filter($all_countries, function($item) use ($search_string) {
99 99
             return strpos($item, strtolower($search_string)) === 0;
100 100
         }));
101 101
 
Please login to merge, or discard this patch.
src/Lib/StdCodes.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     private function optimizeStdCodesData($all_std_codes_data)
53 53
     {
54 54
         $str_length = strlen($all_std_codes_data) - 4;
55
-        $all_std_codes_trimmed_data = substr($all_std_codes_data, 0, 2).substr($all_std_codes_data, 3, $str_length);
55
+        $all_std_codes_trimmed_data = substr($all_std_codes_data, 0, 2) . substr($all_std_codes_data, 3, $str_length);
56 56
         $hash = new Encrypter($this->en_key, $this->cipher);
57 57
 
58 58
         return $hash->decrypt($all_std_codes_trimmed_data);
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
         }
96 96
         $std_codes = $this->getOptimizedStdCodesData();
97 97
 
98
-        return collect($std_codes)->filter(function ($item) use ($search_string) {
98
+        return collect($std_codes)->filter(function($item) use ($search_string) {
99 99
             return (substr(strtolower($item['country_name']), 0, strlen($search_string)) == strtolower($search_string)) ||
100 100
                 (strtolower($item['country_code']) == strtolower($search_string)) ||
101 101
                 (strpos(strtolower($item['std_code']), strtolower($search_string)) !== false);
102
-        })->transform(function ($value) {
102
+        })->transform(function($value) {
103 103
             return Arr::except($value, 'id');
104 104
         })->values();
105 105
     }
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
         }
119 119
         $std_codes = $this->getOptimizedStdCodesData();
120 120
 
121
-        return collect($std_codes)->filter(function ($item) use ($country_name) {
121
+        return collect($std_codes)->filter(function($item) use ($country_name) {
122 122
             return substr(strtolower($item['country_name']), 0, strlen($country_name)) == strtolower($country_name);
123
-        })->transform(function ($value) {
123
+        })->transform(function($value) {
124 124
             return Arr::except($value, 'id');
125 125
         })->values();
126 126
     }
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
         }
140 140
         $std_codes = $this->getOptimizedStdCodesData();
141 141
 
142
-        return collect($std_codes)->filter(function ($item) use ($country_code) {
142
+        return collect($std_codes)->filter(function($item) use ($country_code) {
143 143
             return strtolower($item['country_code']) == strtolower($country_code);
144
-        })->transform(function ($value) {
144
+        })->transform(function($value) {
145 145
             return Arr::except($value, 'id');
146 146
         })->values();
147 147
     }
Please login to merge, or discard this patch.
src/Lib/ISOCodes.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     private function optimizeISOData($all_iso_data)
54 54
     {
55 55
         $str_length = strlen($all_iso_data) - 4;
56
-        $all_iso_trimmed_data = substr($all_iso_data, 0, 2).substr($all_iso_data, 3, $str_length);
56
+        $all_iso_trimmed_data = substr($all_iso_data, 0, 2) . substr($all_iso_data, 3, $str_length);
57 57
         // $hash = new Encrypter($this->en_key, Config::get('app.cipher'));
58 58
         $hash = new Encrypter($this->en_key, $this->cipher);
59 59
         $all_iso = $hash->decrypt($all_iso_trimmed_data);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     private function optimizeIsoResult($iso_codes, $alpha_code)
86 86
     {
87 87
         $group_by = ctype_digit($alpha_code) ? 'country_numeric_code' : ((strlen($alpha_code) == 2) ? 'alpha_2' : 'alpha_3');
88
-        $alpha_code = ctype_digit($alpha_code) ? (int) $alpha_code : strtoupper($alpha_code);
88
+        $alpha_code = ctype_digit($alpha_code) ? (int)$alpha_code : strtoupper($alpha_code);
89 89
         $result = collect($iso_codes)->groupBy($group_by)->get($alpha_code);
90 90
         if ($result == null) {
91 91
             return $this->isoErrorResponse();
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     private function filterRegions($regions, $region)
127 127
     {
128
-        return collect($regions)->filter(function ($item, $key) use ($region) {
128
+        return collect($regions)->filter(function($item, $key) use ($region) {
129 129
             return ($region == null) ? true : (strpos(strtolower($key), strtolower($region)) === 0) ? true : false;
130 130
         });
131 131
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $regions_data = $this->formatRegions($iso_codes);
178 178
         $regions = array_keys($regions_data);
179 179
 
180
-        return collect($regions)->map(function ($item) {
180
+        return collect($regions)->map(function($item) {
181 181
             return ['key' => strtolower($item), 'name' => $item];
182 182
         });
183 183
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         }
198 198
         $iso_data = $this->getOptimizedIsoData();
199 199
 
200
-        return array_values(array_filter($iso_data, function ($item) use ($key) {
200
+        return array_values(array_filter($iso_data, function($item) use ($key) {
201 201
             return Str::contains(strtolower($item['name']), strtolower($key)) ||
202 202
             Str::contains(strtolower($item['alpha_2']), strtolower($key)) ||
203 203
             Str::contains(strtolower($item['alpha_3']), strtolower($key)) ||
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
      */
216 216
     private function filterIsoInfoByCountryName($iso_codes, $name)
217 217
     {
218
-        return collect($iso_codes)->map(function ($item, $key) {
218
+        return collect($iso_codes)->map(function($item, $key) {
219 219
             $item['display_name'] = $item['name'];
220 220
             $item['name'] = strtolower(Str::studly($item['name']));
221 221
 
222 222
             return $item;
223
-        })->groupBy('name')->filter(function ($item, $key) use ($name) {
223
+        })->groupBy('name')->filter(function($item, $key) use ($name) {
224 224
             return strpos($key, $name) === 0;
225 225
         })->collapse();
226 226
     }
Please login to merge, or discard this patch.
src/Lib/Cities.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     private function optimizeCountriesData($all_countries_data)
45 45
     {
46 46
         $str_length = strlen($all_countries_data) - 4;
47
-        $all_countries_trimmed_data = substr($all_countries_data, 0, 2).substr($all_countries_data, 3, $str_length);
47
+        $all_countries_trimmed_data = substr($all_countries_data, 0, 2) . substr($all_countries_data, 3, $str_length);
48 48
         $hash = new Encrypter($this->en_key, $this->cipher);
49 49
 
50 50
         return $hash->decrypt($all_countries_trimmed_data);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     private function optimizeStatesData($all_states_data)
74 74
     {
75 75
         $str_length = strlen($all_states_data) - 15;
76
-        $all_states_trimmed_data = substr($all_states_data, 0, 14).substr($all_states_data, 15, $str_length);
76
+        $all_states_trimmed_data = substr($all_states_data, 0, 14) . substr($all_states_data, 15, $str_length);
77 77
 
78 78
         return unserialize($all_states_trimmed_data);
79 79
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     private function optimizeCitiesData($all_cities_data)
102 102
     {
103 103
         $str_length = strlen($all_cities_data) - 15;
104
-        $all_cities_trimmed_data = substr($all_cities_data, 0, 14).substr($all_cities_data, 15, $str_length);
104
+        $all_cities_trimmed_data = substr($all_cities_data, 0, 14) . substr($all_cities_data, 15, $str_length);
105 105
 
106 106
         return unserialize($all_cities_trimmed_data);
107 107
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         }
194 194
         $cities = $this->formatCitiesData();
195 195
 
196
-        return array_values(array_filter($cities, function ($item) use ($search_key) {
196
+        return array_values(array_filter($cities, function($item) use ($search_key) {
197 197
             return Str::startsWith(strtolower($item['city']), strtolower($search_key));
198 198
         }));
199 199
     }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $states = $this->getOptimizedStatesData();
210 210
 
211
-        return array_map(function ($item) {
211
+        return array_map(function($item) {
212 212
             return $item['state_name'];
213 213
         }, $states);
214 214
     }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $countries = $this->getOptimizedCountriesData();
225 225
 
226
-        return array_map(function ($item) {
226
+        return array_map(function($item) {
227 227
             return $item['country_name'];
228 228
         }, $countries);
229 229
     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         }
243 243
         $cities = $this->formatCitiesData();
244 244
 
245
-        return array_values(array_filter($cities, function ($item) use ($state_name) {
245
+        return array_values(array_filter($cities, function($item) use ($state_name) {
246 246
             return strtolower($item['state']) == strtolower($state_name);
247 247
         }));
248 248
     }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         }
262 262
         $cities = $this->formatCitiesData();
263 263
 
264
-        return array_values(array_filter($cities, function ($item) use ($country_name) {
264
+        return array_values(array_filter($cities, function($item) use ($country_name) {
265 265
             return strtolower($item['country']) == strtolower($country_name);
266 266
         }));
267 267
     }
Please login to merge, or discard this patch.