Completed
Push — master ( cea077...33308d )
by Philipp
05:08
created
src/Localization/TongueDetector.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Accent/Accent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
26 26
         $pass = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : '';
27 27
         $url .= $user.(($user || $pass) ? "$pass@" : '');
28
-        if (! empty($url)) {
28
+        if (!empty($url)) {
29 29
             $url .= isset($parsed_url['path']) ? '/'.ltrim($parsed_url['path'], '/') : '';
30 30
         } elseif (empty($url)) {
31 31
             $url .= isset($parsed_url['path']) ? $parsed_url['path'] : '';
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/ServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
config/localization.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'],
Please login to merge, or discard this patch.
src/Localization/Localization.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $locale = self::fromUrl();
21 21
 
22
-        if (! $locale || ! tongue()->isSpeaking($locale)) {
23
-            if (! Config::beautify()) {
22
+        if (!$locale || !tongue()->isSpeaking($locale)) {
23
+            if (!Config::beautify()) {
24 24
                 return Config::fallbackLocale(); //redirects see test it_ignoes_cookies_and_redirects....
25 25
             }
26 26
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     protected static function languageIsSet()
87 87
     {
88
-        return ! app()->runningInConsole() || array_has(request()->server(), 'HTTP_ACCEPT_LANGUAGE');
88
+        return !app()->runningInConsole() || array_has(request()->server(), 'HTTP_ACCEPT_LANGUAGE');
89 89
     }
90 90
 
91 91
     /**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             return cookie()->queue(cookie()->forever(self::COOKIE, $locale));
103 103
         }
104 104
 
105
-        if (! request()->hasCookie(self::COOKIE)) {
105
+        if (!request()->hasCookie(self::COOKIE)) {
106 106
             return;
107 107
         }
108 108
 
Please login to merge, or discard this patch.
src/Tongue.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $locale = $this->app->getLocale();
48 48
 
49
-        if (! $key) {
49
+        if (!$key) {
50 50
             return $locale;
51 51
         }
52 52
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         //fallback language is the same as the current language
95 95
         if (Config::beautify() && $this->current() === Config::fallbackLocale()) {
96 96
             //didn't found locale means browser is set to exmaple.com
97
-            if (! $locale) {
97
+            if (!$locale) {
98 98
                 return false;
99 99
             }
100 100
             //browser is set to en.example.com but should be forced back to example.com
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function speaks(string $locale)
118 118
     {
119
-        if (! $this->isSpeaking($locale)) {
119
+        if (!$this->isSpeaking($locale)) {
120 120
             return abort(404); //oder error?
121 121
         }
122 122
 
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $locales = Config::supportedLocales();
160 160
 
161
-        if (empty($locales) || ! is_array($locales)) {
161
+        if (empty($locales) || !is_array($locales)) {
162 162
             throw new SupportedLocalesNotDefined();
163 163
         }
164 164
 
165
-        if (! $key) {
165
+        if (!$key) {
166 166
             return collect($locales);
167 167
         }
168 168
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             return $this->BCP47($locale, $locales);
171 171
         }
172 172
 
173
-        if (! array_has($locales, "{$locale}.{$key}")) {
173
+        if (!array_has($locales, "{$locale}.{$key}")) {
174 174
             throw new SupportedLocalesNotDefined();
175 175
         }
176 176
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $bcp47 = data_get($locales, "{$locale}.regional");
212 212
 
213
-        if (! $bcp47) {
213
+        if (!$bcp47) {
214 214
             return $locale;
215 215
         } //locale is the "minimum" of BCP 47
216 216
 
Please login to merge, or discard this patch.
src/Middleware/TongueSpeaksLocale.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Dialect.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
     protected function addLocaleToHost($locale) 
165 165
     {
166 166
         if(Config::beautify() && $locale === tongue()->current() && $locale === Config::fallbackLocale()){
167
-             return Localization::domain();
167
+                return Localization::domain();
168 168
         }
169 169
 
170 170
         // Add locale to the host
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
163 163
      */
164 164
     protected function addLocaleToHost($locale) 
165 165
     {
166
-        if(Config::beautify() && $locale === tongue()->current() && $locale === Config::fallbackLocale()){
166
+        if (Config::beautify() && $locale === tongue()->current() && $locale === Config::fallbackLocale()) {
167 167
              return Localization::domain();
168 168
         }
169 169
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $routePath = Accent::findRoutePathByName($routeName);
184 184
 
185
-        if (! isset($this->translatedRoutes[$routeName])) {
185
+        if (!isset($this->translatedRoutes[$routeName])) {
186 186
             $this->translatedRoutes[$routeName] = $routePath;
187 187
         }
188 188
 
Please login to merge, or discard this patch.