@@ -26,15 +26,15 @@ |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function run() |
|
29 | + public function run () |
|
30 | 30 | { |
31 | 31 | // Initializing variables. |
32 | 32 | $createdAt = date('Y-m-d H:i:s'); |
33 | 33 | $languages = []; |
34 | 34 | |
35 | 35 | // Definition of default languages. |
36 | - $languages[] = ['name' => 'English', 'locale' => 'en-gb', 'abbreviation' => 'EN', 'installed' => '1', 'active' => '1','standard' => '0']; |
|
37 | - $languages[] = ['name' => 'German', 'locale' => 'de-de', 'abbreviation' => 'DE', 'installed' => '1', 'active' => '1','standard' => '0']; |
|
36 | + $languages[] = ['name' => 'English', 'locale' => 'en-gb', 'abbreviation' => 'EN', 'installed' => '1', 'active' => '1', 'standard' => '0']; |
|
37 | + $languages[] = ['name' => 'German', 'locale' => 'de-de', 'abbreviation' => 'DE', 'installed' => '1', 'active' => '1', 'standard' => '0']; |
|
38 | 38 | |
39 | 39 | foreach ($languages as $id => $language) { |
40 | 40 | $languages[$id] = array_merge($language, ['created_at' => $createdAt, 'updated_at' => $createdAt]); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param \Illuminate\Cache\CacheManager $cacheManager The cache manager object |
110 | 110 | */ |
111 | - public function __construct(CacheManager $cacheManager) |
|
111 | + public function __construct (CacheManager $cacheManager) |
|
112 | 112 | { |
113 | 113 | $this->addressClass = config('localisation.models.address'); |
114 | 114 | $this->countryClass = config('localisation.models.country'); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return void |
126 | 126 | */ |
127 | - protected function initializeCache() |
|
127 | + protected function initializeCache () |
|
128 | 128 | { |
129 | 129 | self::$cacheExpirationTime = config('localisation.cache.expiration_time', config('localisation.cache_expiration_time')); |
130 | 130 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return Repository Cache store |
141 | 141 | */ |
142 | - protected function getCacheStoreFromConfig(): Repository |
|
142 | + protected function getCacheStoreFromConfig (): Repository |
|
143 | 143 | { |
144 | 144 | // the 'default' fallback here is from the localisation.php config file, where 'default' means to use config(cache.default) |
145 | 145 | $cacheDriver = config('localisation.cache.store', 'default'); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * Register the languages check method. |
162 | 162 | */ |
163 | - public function registerLanguages(): bool |
|
163 | + public function registerLanguages (): bool |
|
164 | 164 | { |
165 | 165 | return true; |
166 | 166 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return bool |
172 | 172 | */ |
173 | - public function forgetCachedAddresses() |
|
173 | + public function forgetCachedAddresses () |
|
174 | 174 | { |
175 | 175 | $this->addresses = null; |
176 | 176 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return bool |
184 | 184 | */ |
185 | - public function forgetCachedLanguages() |
|
185 | + public function forgetCachedLanguages () |
|
186 | 186 | { |
187 | 187 | $this->languages = null; |
188 | 188 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return void |
198 | 198 | */ |
199 | - public function clearClassLanguages() |
|
199 | + public function clearClassLanguages () |
|
200 | 200 | { |
201 | 201 | $this->languages = null; |
202 | 202 | } |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param array $params additional parameters for query |
208 | 208 | */ |
209 | - public function getAddresses(array $params = []): Collection |
|
209 | + public function getAddresses (array $params = []): Collection |
|
210 | 210 | { |
211 | 211 | if (null === $this->addresses) { |
212 | 212 | $this->addresses = $this->cache->remember( |
213 | - self::$cacheKey . '.addresses', |
|
213 | + self::$cacheKey.'.addresses', |
|
214 | 214 | self::$cacheExpirationTime, |
215 | - function () { |
|
215 | + function() { |
|
216 | 216 | return $this->getAddressClass() |
217 | 217 | //->with('countries') |
218 | 218 | ->get(); |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param array $params additional parameters for query |
236 | 236 | */ |
237 | - public function getLanguages(array $params = []): Collection |
|
237 | + public function getLanguages (array $params = []): Collection |
|
238 | 238 | { |
239 | 239 | if (null === $this->languages) { |
240 | 240 | $this->languages = $this->cache->remember( |
241 | 241 | self::$cacheKey, |
242 | 242 | self::$cacheExpirationTime, |
243 | - function () { |
|
243 | + function() { |
|
244 | 244 | return $this->getLanguageClass() |
245 | 245 | //->with('countries') |
246 | 246 | ->get(); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @return PWWeb\Localisation\Contract\Address |
264 | 264 | */ |
265 | - public function getAddressClass(): Address |
|
265 | + public function getAddressClass (): Address |
|
266 | 266 | { |
267 | 267 | return app($this->addressClass); |
268 | 268 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | /** |
271 | 271 | * Get an instance of the country class. |
272 | 272 | */ |
273 | - public function getCountryClass(): Country |
|
273 | + public function getCountryClass (): Country |
|
274 | 274 | { |
275 | 275 | return app($this->countryClass); |
276 | 276 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * Get an instance of the currency class. |
280 | 280 | */ |
281 | - public function getCurrencyClass(): Currency |
|
281 | + public function getCurrencyClass (): Currency |
|
282 | 282 | { |
283 | 283 | return app($this->currencyClass); |
284 | 284 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * Get an instance of the language class. |
288 | 288 | */ |
289 | - public function getLanguageClass(): Language |
|
289 | + public function getLanguageClass (): Language |
|
290 | 290 | { |
291 | 291 | return app($this->languageClass); |
292 | 292 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return object |
300 | 300 | */ |
301 | - public function setAddressClass(string $addressClass) |
|
301 | + public function setAddressClass (string $addressClass) |
|
302 | 302 | { |
303 | 303 | $this->addressClass = $addressClass; |
304 | 304 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return object |
314 | 314 | */ |
315 | - public function setLanguageClass(string $languageClass) |
|
315 | + public function setLanguageClass (string $languageClass) |
|
316 | 316 | { |
317 | 317 | $this->languageClass = $languageClass; |
318 | 318 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * Get the instance of the Cache Store. |
324 | 324 | */ |
325 | - public function getCacheStore(): \Illuminate\Contracts\Cache\Store |
|
325 | + public function getCacheStore (): \Illuminate\Contracts\Cache\Store |
|
326 | 326 | { |
327 | 327 | return $this->cache->getStore(); |
328 | 328 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | * |
12 | 12 | * @return string Name of the facade. |
13 | 13 | */ |
14 | - public static function getFacadeAccessor() |
|
14 | + public static function getFacadeAccessor () |
|
15 | 15 | { |
16 | 16 | return 'localisation'; |
17 | 17 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @return \Illuminate\Contracts\Support\Renderable |
18 | 18 | */ |
19 | - public function index() |
|
19 | + public function index () |
|
20 | 20 | { |
21 | 21 | $countries = Country::all(); |
22 | 22 | $currencies = Currency::all(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Retrieve and return the address class to be used. |
31 | 31 | */ |
32 | - public function getAddressClass(): string |
|
32 | + public function getAddressClass (): string |
|
33 | 33 | { |
34 | 34 | if (false === isset($this->addressClass)) { |
35 | 35 | $this->addressClass = app(LocalisationRegistrar::class)->getAddressClass(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * A model may have multiple addresses. |
43 | 43 | */ |
44 | - public function addresses(): MorphToMany |
|
44 | + public function addresses (): MorphToMany |
|
45 | 45 | { |
46 | 46 | return $this->morphToMany( |
47 | 47 | config('localisation.models.address'), |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return $this |
61 | 61 | */ |
62 | - public function assignAddress(...$addresses) |
|
62 | + public function assignAddress (...$addresses) |
|
63 | 63 | { |
64 | 64 | $addresses = collect($addresses) |
65 | 65 | ->flatten() |
66 | 66 | ->map( |
67 | - function ($address) { |
|
67 | + function($address) { |
|
68 | 68 | if (true === empty($address)) { |
69 | 69 | return false; |
70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | ) |
75 | 75 | ->filter( |
76 | - function ($address) { |
|
76 | + function($address) { |
|
77 | 77 | return $address instanceof Address; |
78 | 78 | } |
79 | 79 | ) |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $class = \get_class($model); |
90 | 90 | |
91 | 91 | $class::saved( |
92 | - function ($object) use ($addresses, $model) { |
|
92 | + function($object) use ($addresses, $model) { |
|
93 | 93 | static $modelLastFiredOn; |
94 | 94 | if (null !== $modelLastFiredOn && $modelLastFiredOn === $model) { |
95 | 95 | return; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param int|string $address Address to be retrieved from cache |
113 | 113 | */ |
114 | - protected function getStoredAddress($address): Address |
|
114 | + protected function getStoredAddress ($address): Address |
|
115 | 115 | { |
116 | 116 | $addressClass = $this->getAddressClass(); |
117 | 117 |
@@ -11,5 +11,5 @@ |
||
11 | 11 | * |
12 | 12 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
13 | 13 | */ |
14 | - public function languages(): HasMany; |
|
14 | + public function languages (): HasMany; |
|
15 | 15 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
24 | 24 | */ |
25 | - public function countries(): BelongsToMany; |
|
25 | + public function countries (): BelongsToMany; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Find a Language by its name. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return Language |
35 | 35 | */ |
36 | - public static function findByName(string $name): self; |
|
36 | + public static function findByName (string $name): self; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Find a Language by its id. |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return Language |
46 | 46 | */ |
47 | - public static function findById(int $id): self; |
|
47 | + public static function findById (int $id): self; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Find a Language by its locale, e.g. en-gb. |
@@ -55,5 +55,5 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return Language |
57 | 57 | */ |
58 | - public static function findByLocale(string $locale): self; |
|
58 | + public static function findByLocale (string $locale): self; |
|
59 | 59 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return static |
25 | 25 | */ |
26 | - public static function create(string $addressName) |
|
26 | + public static function create (string $addressName) |
|
27 | 27 | { |
28 | 28 | return new static("There is no address named `{$addressName}`."); |
29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return static |
37 | 37 | */ |
38 | - public static function withId(int $addressId) |
|
38 | + public static function withId (int $addressId) |
|
39 | 39 | { |
40 | 40 | return new static("There is no [address] with id `{$addressId}`."); |
41 | 41 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return static |
25 | 25 | */ |
26 | - public static function create(string $languageName) |
|
26 | + public static function create (string $languageName) |
|
27 | 27 | { |
28 | 28 | return new static("There is no language named `{$languageName}`."); |
29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return static |
37 | 37 | */ |
38 | - public static function withId(int $languageId) |
|
38 | + public static function withId (int $languageId) |
|
39 | 39 | { |
40 | 40 | return new static("There is no [language] with id `{$languageId}`."); |
41 | 41 | } |