Completed
Push — master ( 75e5ce...dbefe4 )
by Avtandil
13:47
created
src/MultiLang/MultiLang.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function setLocale(string $lang)
179 179
     {
180
-        if (! $lang) {
180
+        if (!$lang) {
181 181
             throw new InvalidArgumentException('Locale is empty');
182 182
         }
183 183
         $this->lang = $lang;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function get(string $key, array $replacements = []): string
222 222
     {
223
-        if (! $this->getConfig()->get('use_texts', true)) {
223
+        if (!$this->getConfig()->get('use_texts', true)) {
224 224
             throw new InvalidArgumentException('Using texts from database is disabled in config');
225 225
         }
226 226
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             throw new InvalidArgumentException('Text key not provided');
229 229
         }
230 230
 
231
-        if (! $this->lang) {
231
+        if (!$this->lang) {
232 232
             return $key;
233 233
         }
234 234
 
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
             $this->loadTexts();
238 238
         }
239 239
 
240
-        if (! isset($this->texts[$key])) {
240
+        if (!isset($this->texts[$key])) {
241 241
             $this->queueToSave($key);
242 242
         }
243 243
 
244
-        if (! empty($replacements)) {
244
+        if (!empty($replacements)) {
245 245
             $keys = array_keys($replacements);
246
-            $keys = array_map(static function ($v) {
246
+            $keys = array_map(static function($v) {
247 247
                 return ':' . $v;
248 248
             }, $keys);
249 249
             $replacements = array_combine($keys, $replacements);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     public function getRedirectUrl(Request $request): string
262 262
     {
263 263
         $excludePatterns = $this->config->get('exclude_segments', []);
264
-        if (! empty($excludePatterns)) {
264
+        if (!empty($excludePatterns)) {
265 265
             if (call_user_func_array([$request, 'is'], $excludePatterns)) {
266 266
                 return '';
267 267
             }
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 
270 270
         $locale = $request->segment(1);
271 271
         $fallbackLocale = $this->config->get('default_locale', 'en');
272
-        if (! empty($locale) && strlen($locale) === 2) {
272
+        if (!empty($locale) && strlen($locale) === 2) {
273 273
             $locales = $this->config->get('locales', []);
274 274
 
275
-            if (! isset($locales[$locale])) {
275
+            if (!isset($locales[$locale])) {
276 276
                 $segments = $request->segments();
277 277
                 $segments[0] = $fallbackLocale;
278 278
                 $url = implode('/', $segments);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
         // Remove domain from path
493 493
         $appUrl = config('app.url', '');
494
-        if (! empty($appUrl) && mb_substr($langPath, 0, mb_strlen($appUrl)) === $appUrl) {
494
+        if (!empty($appUrl) && mb_substr($langPath, 0, mb_strlen($appUrl)) === $appUrl) {
495 495
             $langPath = ltrim(str_replace($appUrl, '', $langPath), '/');
496 496
         }
497 497
 
Please login to merge, or discard this patch.