@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $matches = $this->getMatchesFromAcceptedLanguages(); |
| 65 | 65 | |
| 66 | 66 | foreach ($matches as $key => $q) { |
| 67 | - if (! empty($this->supportedLanguages[$key])) { |
|
| 67 | + if (!empty($this->supportedLanguages[$key])) { |
|
| 68 | 68 | return $key; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | return key($this->supportedLanguages); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ($this->use_intl && ! empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 90 | + if ($this->use_intl && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
| 91 | 91 | $http_accept_language = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); |
| 92 | 92 | |
| 93 | - if (! empty($this->supportedLanguages[$http_accept_language])) { |
|
| 93 | + if (!empty($this->supportedLanguages[$http_accept_language])) { |
|
| 94 | 94 | return $http_accept_language; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $remote_host = explode('.', $this->request->server('REMOTE_HOST')); |
| 100 | 100 | $lang = strtolower(end($remote_host)); |
| 101 | 101 | |
| 102 | - if (! empty($this->supportedLanguages[$lang])) { |
|
| 102 | + if (!empty($this->supportedLanguages[$lang])) { |
|
| 103 | 103 | return $lang; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | //less than it's parent. |
| 144 | 144 | $l_ops = explode('-', $l); |
| 145 | 145 | array_pop($l_ops); |
| 146 | - while (! empty($l_ops)) { |
|
| 146 | + while (!empty($l_ops)) { |
|
| 147 | 147 | //The new generic option needs to be slightly less important than it's base |
| 148 | 148 | $q -= 0.001; |
| 149 | 149 | $op = implode('-', $l_ops); |
@@ -3,13 +3,13 @@ |
||
| 3 | 3 | use Pmochine\LaravelTongue\Tongue; |
| 4 | 4 | use Pmochine\LaravelTongue\Dialect; |
| 5 | 5 | |
| 6 | -if (! function_exists('tongue')) { |
|
| 6 | +if (!function_exists('tongue')) { |
|
| 7 | 7 | function tongue() |
| 8 | 8 | { |
| 9 | 9 | return app()->make(Tongue::class); |
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | -if (! function_exists('dialect')) { |
|
| 12 | +if (!function_exists('dialect')) { |
|
| 13 | 13 | function dialect() |
| 14 | 14 | { |
| 15 | 15 | return app()->make(Dialect::class); |
@@ -20,11 +20,11 @@ |
||
| 20 | 20 | 'localization' |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | - $this->app->singleton('tongue', function ($app) { |
|
| 23 | + $this->app->singleton('tongue', function($app) { |
|
| 24 | 24 | return new Tongue($app); |
| 25 | 25 | }); |
| 26 | 26 | |
| 27 | - $this->app->singleton('dialect', function ($app) { |
|
| 27 | + $this->app->singleton('dialect', function($app) { |
|
| 28 | 28 | return new Dialect($app); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -74,24 +74,24 @@ discard block |
||
| 74 | 74 | //'cy' => ['name' => 'Welsh', 'script' => 'Latn', 'native' => 'Cymraeg', 'regional' => 'cy_GB'], |
| 75 | 75 | //'da' => ['name' => 'Danish', 'script' => 'Latn', 'native' => 'dansk', 'regional' => 'da_DK'], |
| 76 | 76 | //'se' => ['name' => 'Northern Sami', 'script' => 'Latn', 'native' => 'davvisámegiella', 'regional' => 'se_NO'], |
| 77 | - 'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'], |
|
| 77 | + 'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'], |
|
| 78 | 78 | //'luo' => ['name' => 'Luo', 'script' => 'Latn', 'native' => 'Dholuo', 'regional' => ''], |
| 79 | 79 | //'nv' => ['name' => 'Navajo', 'script' => 'Latn', 'native' => 'Diné bizaad', 'regional' => ''], |
| 80 | 80 | //'dua' => ['name' => 'Duala', 'script' => 'Latn', 'native' => 'duálá', 'regional' => ''], |
| 81 | 81 | //'et' => ['name' => 'Estonian', 'script' => 'Latn', 'native' => 'eesti', 'regional' => 'et_EE'], |
| 82 | 82 | //'na' => ['name' => 'Nauru', 'script' => 'Latn', 'native' => 'Ekakairũ Naoero', 'regional' => ''], |
| 83 | 83 | //'guz' => ['name' => 'Ekegusii', 'script' => 'Latn', 'native' => 'Ekegusii', 'regional' => ''], |
| 84 | - 'en' => ['name' => 'English', 'script' => 'Latn', 'native' => 'English', 'regional' => 'en_GB'], |
|
| 84 | + 'en' => ['name' => 'English', 'script' => 'Latn', 'native' => 'English', 'regional' => 'en_GB'], |
|
| 85 | 85 | //'en-AU' => ['name' => 'Australian English', 'script' => 'Latn', 'native' => 'Australian English', 'regional' => 'en_AU'], |
| 86 | 86 | //'en-GB' => ['name' => 'British English', 'script' => 'Latn', 'native' => 'British English', 'regional' => 'en_GB'], |
| 87 | 87 | //'en-US' => ['name' => 'U.S. English', 'script' => 'Latn', 'native' => 'U.S. English', 'regional' => 'en_US'], |
| 88 | - 'es' => ['name' => 'Spanish', 'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'], |
|
| 88 | + 'es' => ['name' => 'Spanish', 'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'], |
|
| 89 | 89 | //'eo' => ['name' => 'Esperanto', 'script' => 'Latn', 'native' => 'esperanto', 'regional' => ''], |
| 90 | 90 | //'eu' => ['name' => 'Basque', 'script' => 'Latn', 'native' => 'euskara', 'regional' => 'eu_ES'], |
| 91 | 91 | //'ewo' => ['name' => 'Ewondo', 'script' => 'Latn', 'native' => 'ewondo', 'regional' => ''], |
| 92 | 92 | //'ee' => ['name' => 'Ewe', 'script' => 'Latn', 'native' => 'eʋegbe', 'regional' => ''], |
| 93 | 93 | //'fil' => ['name' => 'Filipino', 'script' => 'Latn', 'native' => 'Filipino', 'regional' => 'fil_PH'], |
| 94 | - 'fr' => ['name' => 'French', 'script' => 'Latn', 'native' => 'français', 'regional' => 'fr_FR'], |
|
| 94 | + 'fr' => ['name' => 'French', 'script' => 'Latn', 'native' => 'français', 'regional' => 'fr_FR'], |
|
| 95 | 95 | //'fr-CA' => ['name' => 'Canadian French', 'script' => 'Latn', 'native' => 'français canadien', 'regional' => 'fr_CA'], |
| 96 | 96 | //'fy' => ['name' => 'Western Frisian', 'script' => 'Latn', 'native' => 'frysk', 'regional' => 'fy_DE'], |
| 97 | 97 | //'fur' => ['name' => 'Friulian', 'script' => 'Latn', 'native' => 'furlan', 'regional' => 'fur_IT'], |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | //'lg' => ['name' => 'Ganda', 'script' => 'Latn', 'native' => 'Luganda', 'regional' => 'lg_UG'], |
| 163 | 163 | //'luy' => ['name' => 'Oluluyia', 'script' => 'Latn', 'native' => 'Luluhia', 'regional' => ''], |
| 164 | 164 | //'lb' => ['name' => 'Luxembourgish', 'script' => 'Latn', 'native' => 'Lëtzebuergesch', 'regional' => 'lb_LU'], |
| 165 | - 'hu' => ['name' => 'Hungarian', 'script' => 'Latn', 'native' => 'magyar', 'regional' => 'hu_HU'], |
|
| 165 | + 'hu' => ['name' => 'Hungarian', 'script' => 'Latn', 'native' => 'magyar', 'regional' => 'hu_HU'], |
|
| 166 | 166 | //'mgh' => ['name' => 'Makhuwa-Meetto', 'script' => 'Latn', 'native' => 'Makua', 'regional' => ''], |
| 167 | 167 | //'mg' => ['name' => 'Malagasy', 'script' => 'Latn', 'native' => 'Malagasy', 'regional' => 'mg_MG'], |
| 168 | 168 | //'mt' => ['name' => 'Maltese', 'script' => 'Latn', 'native' => 'Malti', 'regional' => 'mt_MT'], |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function translate($routeName, $routeAttributes = null, $locale = null) |
| 124 | 124 | { |
| 125 | 125 | // If no locale is given, we use the current locale |
| 126 | - if (! $locale) { |
|
| 126 | + if (!$locale) { |
|
| 127 | 127 | $locale = tongue()->current(); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $routePath = Accent::findRoutePathByName($routeName); |
| 165 | 165 | |
| 166 | - if (! isset($this->translatedRoutes[$routeName])) { |
|
| 166 | + if (!isset($this->translatedRoutes[$routeName])) { |
|
| 167 | 167 | $this->translatedRoutes[$routeName] = $routePath; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function handle($request, Closure $next) |
| 21 | 21 | { |
| 22 | - if (tongue()->twister() && ! Config::preventRedirect()) { |
|
| 22 | + if (tongue()->twister() && !Config::preventRedirect()) { |
|
| 23 | 23 | return dialect()->redirect(dialect()->redirectURL()); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -20,19 +20,19 @@ discard block |
||
| 20 | 20 | return ''; |
| 21 | 21 | } |
| 22 | 22 | $url = ''; |
| 23 | - $url .= isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
| 23 | + $url .= isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
| 24 | 24 | $url .= isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
| 25 | - $url .= isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
| 25 | + $url .= isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
| 26 | 26 | $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; |
| 27 | - $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; |
|
| 28 | - $url .= $user . (($user || $pass) ? "$pass@" : ''); |
|
| 27 | + $pass = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : ''; |
|
| 28 | + $url .= $user.(($user || $pass) ? "$pass@" : ''); |
|
| 29 | 29 | if (!empty($url)) { |
| 30 | - $url .= isset($parsed_url['path']) ? '/' . ltrim($parsed_url['path'], '/') : ''; |
|
| 30 | + $url .= isset($parsed_url['path']) ? '/'.ltrim($parsed_url['path'], '/') : ''; |
|
| 31 | 31 | } elseif (empty($url)) { |
| 32 | 32 | $url .= isset($parsed_url['path']) ? $parsed_url['path'] : ''; |
| 33 | 33 | } |
| 34 | - $url .= isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
| 35 | - $url .= isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
| 34 | + $url .= isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
| 35 | + $url .= isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
| 36 | 36 | |
| 37 | 37 | return $url; |
| 38 | 38 | } |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | public static function substituteAttributesInRoute($attributes, $route) |
| 80 | 80 | { |
| 81 | 81 | foreach ($attributes as $key => $value) { |
| 82 | - $route = str_replace('{' . $key . '}', $value, $route); |
|
| 83 | - $route = str_replace('{' . $key . '?}', $value, $route); |
|
| 82 | + $route = str_replace('{'.$key.'}', $value, $route); |
|
| 83 | + $route = str_replace('{'.$key.'?}', $value, $route); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // delete empty optional arguments that are not in the $attributes array |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | // this could be a future bug |
| 25 | 25 | // when no middleware is active the language is not set right |
| 26 | 26 | // domain.com could be in german etc... |
| 27 | - if (! Config::beautify()) { |
|
| 27 | + if (!Config::beautify()) { |
|
| 28 | 28 | // if the middleware is active we should be redirected to en.domain.com |
| 29 | 29 | // if not the fallback language is going to be used |
| 30 | 30 | return Config::fallbackLocale(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // could be a custom subdomain |
| 37 | - if (! tongue()->isSpeaking($locale)) { |
|
| 37 | + if (!tongue()->isSpeaking($locale)) { |
|
| 38 | 38 | // check if it is a white listed domain |
| 39 | 39 | |
| 40 | 40 | if (tongue()->speaking('subdomains', $locale)) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected static function languageIsSet(): bool |
| 87 | 87 | { |
| 88 | - return ! app()->runningInConsole() || Arr::has(request()->server(), 'HTTP_ACCEPT_LANGUAGE'); |
|
| 88 | + return !app()->runningInConsole() || Arr::has(request()->server(), 'HTTP_ACCEPT_LANGUAGE'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -75,8 +75,8 @@ |
||
| 75 | 75 | $regional = tongue()->speaking('regional', $locale); |
| 76 | 76 | |
| 77 | 77 | if ($regional) { |
| 78 | - setlocale(LC_TIME, $regional . '.UTF-8'); |
|
| 79 | - setlocale(LC_MONETARY, $regional . '.UTF-8'); |
|
| 78 | + setlocale(LC_TIME, $regional.'.UTF-8'); |
|
| 79 | + setlocale(LC_MONETARY, $regional.'.UTF-8'); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |