@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - private $base_path = __DIR__.'/../Res/'; |
|
24 | + private $base_path = __DIR__ . '/../Res/'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * This method contains countries data |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function countries() |
33 | 33 | { |
34 | - $path = $this->base_path.'country_names.txt'; |
|
34 | + $path = $this->base_path . 'country_names.txt'; |
|
35 | 35 | |
36 | 36 | return File::get($path); |
37 | 37 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function countriesISOData() |
45 | 45 | { |
46 | - $path = $this->base_path.'country_iso.txt'; |
|
46 | + $path = $this->base_path . 'country_iso.txt'; |
|
47 | 47 | |
48 | 48 | return File::get($path); |
49 | 49 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function continents() |
57 | 57 | { |
58 | - $path = $path = $this->base_path.'continents.txt'; |
|
58 | + $path = $path = $this->base_path . 'continents.txt'; |
|
59 | 59 | |
60 | 60 | return File::get($path); |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function oceans() |
69 | 69 | { |
70 | - $path = $path = $this->base_path.'oceans.txt'; |
|
70 | + $path = $path = $this->base_path . 'oceans.txt'; |
|
71 | 71 | |
72 | 72 | return File::get($path); |
73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function unionTerritories() |
81 | 81 | { |
82 | - $path = $path = $this->base_path.'territories.txt'; |
|
82 | + $path = $path = $this->base_path . 'territories.txt'; |
|
83 | 83 | |
84 | 84 | return File::get($path); |
85 | 85 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function wonders() |
93 | 93 | { |
94 | - $path = $path = $this->base_path.'wonders.txt'; |
|
94 | + $path = $path = $this->base_path . 'wonders.txt'; |
|
95 | 95 | |
96 | 96 | return File::get($path); |
97 | 97 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function currencies() |
119 | 119 | { |
120 | - $path = $path = $this->base_path.'currencies.txt'; |
|
120 | + $path = $path = $this->base_path . 'currencies.txt'; |
|
121 | 121 | |
122 | 122 | return File::get($path); |
123 | 123 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function stdCodes() |
131 | 131 | { |
132 | - $path = $path = $this->base_path.'std_codes.txt'; |
|
132 | + $path = $path = $this->base_path . 'std_codes.txt'; |
|
133 | 133 | |
134 | 134 | return File::get($path); |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function states() |
143 | 143 | { |
144 | - $path = $path = $this->base_path.'states.txt'; |
|
144 | + $path = $path = $this->base_path . 'states.txt'; |
|
145 | 145 | |
146 | 146 | return File::get($path); |
147 | 147 | } |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function countriesHelper() |
155 | 155 | { |
156 | - $path = $path = $this->base_path.'countries_helper.txt'; |
|
156 | + $path = $path = $this->base_path . 'countries_helper.txt'; |
|
157 | 157 | |
158 | 158 | return File::get($path); |
159 | 159 | } |
160 | 160 | |
161 | 161 | public function cities() |
162 | 162 | { |
163 | - $path = $path = $this->base_path.'cities.txt'; |
|
163 | + $path = $path = $this->base_path . 'cities.txt'; |
|
164 | 164 | |
165 | 165 | return File::get($path); |
166 | 166 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | private function optimizeCurrenciesData($all_currencies_data) |
47 | 47 | { |
48 | 48 | $str_length = strlen($all_currencies_data) - 4; |
49 | - $all_currencies_trimmed_data = substr($all_currencies_data, 0, 2).substr($all_currencies_data, 3, $str_length); |
|
49 | + $all_currencies_trimmed_data = substr($all_currencies_data, 0, 2) . substr($all_currencies_data, 3, $str_length); |
|
50 | 50 | $hash = new Encrypter($this->en_key, $this->cipher); |
51 | 51 | |
52 | 52 | return $hash->decrypt($all_currencies_trimmed_data); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return []; |
90 | 90 | } |
91 | 91 | |
92 | - return collect($this->getOptimizedCurrenciesData())->filter(function ($item) use ($search_key) { |
|
92 | + return collect($this->getOptimizedCurrenciesData())->filter(function($item) use ($search_key) { |
|
93 | 93 | return (strpos(strtolower($item['currency_name']), strtolower($search_key)) !== false) || |
94 | 94 | (strpos(strtolower($item['country_name']), strtolower($search_key)) !== false); |
95 | 95 | })->values(); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | return []; |
109 | 109 | } |
110 | 110 | |
111 | - return collect($this->getOptimizedCurrenciesData())->filter(function ($item) use ($country_name) { |
|
111 | + return collect($this->getOptimizedCurrenciesData())->filter(function($item) use ($country_name) { |
|
112 | 112 | return strtolower($item['country_name']) == strtolower($country_name); |
113 | 113 | })->values(); |
114 | 114 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return []; |
127 | 127 | } |
128 | 128 | |
129 | - return collect($this->getOptimizedCurrenciesData())->filter(function ($item) use ($country_code) { |
|
129 | + return collect($this->getOptimizedCurrenciesData())->filter(function($item) use ($country_code) { |
|
130 | 130 | return strtolower($item['country_code']) == strtolower($country_code); |
131 | 131 | })->values(); |
132 | 132 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | return []; |
145 | 145 | } |
146 | 146 | |
147 | - return collect($this->getOptimizedCurrenciesData())->filter(function ($item) use ($currency_name) { |
|
147 | + return collect($this->getOptimizedCurrenciesData())->filter(function($item) use ($currency_name) { |
|
148 | 148 | return strpos(strtolower($item['currency_name']), strtolower($currency_name)) !== false; |
149 | 149 | })->values(); |
150 | 150 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return []; |
163 | 163 | } |
164 | 164 | |
165 | - return collect($this->getOptimizedCurrenciesData())->filter(function ($item) use ($currency_code) { |
|
165 | + return collect($this->getOptimizedCurrenciesData())->filter(function($item) use ($currency_code) { |
|
166 | 166 | return strtolower($item['currency_code']) == strtolower($currency_code); |
167 | 167 | })->values(); |
168 | 168 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | date_default_timezone_set($zone); |
45 | 45 | $zones_array[$key]['region'] = $zones_array[$key]['region'] = substr($zone, 0, strpos($zone, '/')); |
46 | 46 | $zones_array[$key]['zone'] = $zone; |
47 | - $zones_array[$key]['diff_from_GMT'] = 'UTC/GMT '.date('P', $timestamp); |
|
47 | + $zones_array[$key]['diff_from_GMT'] = 'UTC/GMT ' . date('P', $timestamp); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $zones_array; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return []; |
115 | 115 | } |
116 | 116 | $timezones = $this->prepareTimezones(); |
117 | - $filtered_timezones = collect($timezones)->filter(function ($item) use ($search_key) { |
|
117 | + $filtered_timezones = collect($timezones)->filter(function($item) use ($search_key) { |
|
118 | 118 | return strpos(strtolower($item['zone']), strtolower($search_key)) !== false; |
119 | 119 | })->values(); |
120 | 120 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function register() |
23 | 23 | { |
24 | - $this->app->bind('bs-world', function () { |
|
24 | + $this->app->bind('bs-world', function() { |
|
25 | 25 | return new World(new DataRepository()); |
26 | 26 | }); |
27 | 27 | } |
@@ -34,6 +34,6 @@ discard block |
||
34 | 34 | public function boot() |
35 | 35 | { |
36 | 36 | // $this->loadRoutesFrom(__DIR__ . '/routes/routes.php'); |
37 | - $this->publishes([__DIR__.'/Config/world.php' => config_path('world.php')], 'config'); |
|
37 | + $this->publishes([__DIR__ . '/Config/world.php' => config_path('world.php')], 'config'); |
|
38 | 38 | } |
39 | 39 | } |
@@ -31,20 +31,20 @@ |
||
31 | 31 | $prev_page_url = null; |
32 | 32 | } else { |
33 | 33 | $from = ($page_number * $per_page) - $per_page; |
34 | - $prev_page_url = $request_url.'?page='.($page_number - 1); |
|
34 | + $prev_page_url = $request_url . '?page=' . ($page_number - 1); |
|
35 | 35 | } |
36 | 36 | if ($page_number >= $ceil_val) { |
37 | 37 | $next_page_url = null; |
38 | 38 | } else { |
39 | - $next_page_url = $request_url.'?page='.($page_number + 1); |
|
39 | + $next_page_url = $request_url . '?page=' . ($page_number + 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return [ |
43 | - 'current_page' => (int) $page_number, |
|
44 | - 'first_page_url' => $request_url.'?page=1', |
|
43 | + 'current_page' => (int)$page_number, |
|
44 | + 'first_page_url' => $request_url . '?page=1', |
|
45 | 45 | 'from' => $from, |
46 | 46 | 'last_page' => $ceil_val, |
47 | - 'last_page_url' => $request_url.'?page='.$ceil_val, |
|
47 | + 'last_page_url' => $request_url . '?page=' . $ceil_val, |
|
48 | 48 | 'next_page_url' => $next_page_url, |
49 | 49 | 'path' => $request_url, |
50 | 50 | 'per_page' => $per_page, |
@@ -31,20 +31,20 @@ |
||
31 | 31 | $prev_page_url = null; |
32 | 32 | } else { |
33 | 33 | $from = ($page_number * $per_page) - $per_page; |
34 | - $prev_page_url = $request_url.'?page='.($page_number - 1); |
|
34 | + $prev_page_url = $request_url . '?page=' . ($page_number - 1); |
|
35 | 35 | } |
36 | 36 | if ($page_number >= $ceil_val) { |
37 | 37 | $next_page_url = null; |
38 | 38 | } else { |
39 | - $next_page_url = $request_url.'?page='.($page_number + 1); |
|
39 | + $next_page_url = $request_url . '?page=' . ($page_number + 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return [ |
43 | - 'current_page' => (int) $page_number, |
|
44 | - 'first_page_url' => $request_url.'?page=1', |
|
43 | + 'current_page' => (int)$page_number, |
|
44 | + 'first_page_url' => $request_url . '?page=1', |
|
45 | 45 | 'from' => $from, |
46 | 46 | 'last_page' => $ceil_val, |
47 | - 'last_page_url' => $request_url.'?page='.$ceil_val, |
|
47 | + 'last_page_url' => $request_url . '?page=' . $ceil_val, |
|
48 | 48 | 'next_page_url' => $next_page_url, |
49 | 49 | 'path' => $request_url, |
50 | 50 | 'per_page' => $per_page, |
@@ -30,7 +30,7 @@ |
||
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 */ |
@@ -51,7 +51,7 @@ discard block |
||
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 |
||
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; |
@@ -46,7 +46,7 @@ discard block |
||
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 |
||
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)); |