Completed
Push — master ( d59a3b...064224 )
by Ricardo
13:04
created
src/Commands/FileLoaderCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
         // Load all files inside subdirectories:
107 107
         $directories = $this->files->directories($path);
108 108
         foreach ($directories as $directory) {
109
-            $directoryName = str_replace($path . '/', '', $directory);
110
-            $dirGroup      = $group . basename($directory) . '/';
109
+            $directoryName = str_replace($path.'/', '', $directory);
110
+            $dirGroup      = $group.basename($directory).'/';
111 111
             $this->loadDirectory($directory, $locale, $namespace, $dirGroup);
112 112
         }
113 113
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function loadFile($file, $locale, $namespace = '*', $group = '')
131 131
     {
132
-        $group        = $group . basename($file, '.php');
132
+        $group        = $group.basename($file, '.php');
133 133
         $translations = $this->files->getRequire($file);
134 134
         $this->translationRepository->loadArray($translations, $locale, $group, $namespace, $locale == $this->defaultLocale);
135 135
     }
Please login to merge, or discard this patch.
src/Repositories/TranslationRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             ->get()
242 242
             ->keyBy('item')
243 243
             ->map(
244
-                function ($translation) {
244
+                function($translation) {
245 245
                     return $translation['text'];
246 246
                 }
247 247
             )
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         foreach ($elements as $element) {
288 288
             if ($element) {
289 289
                 $query = $query->where(
290
-                    function ($query) use ($element) {
290
+                    function($query) use ($element) {
291 291
                         $query->where('group', 'like', "%{$element}%")->orWhere('item', 'like', "%{$element}%")->orWhere('text', 'like', "%{$element}%");
292 292
                     }
293 293
                 );
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 
369 369
         return $this->model
370 370
             ->newQuery()
371
-            ->select($table . '.text')
371
+            ->select($table.'.text')
372 372
             ->from($table)
373 373
             ->leftJoin(
374
-                "{$table} as e", function ($join) use ($table, $text, $textLocale) {
374
+                "{$table} as e", function($join) use ($table, $text, $textLocale) {
375 375
                     $join->on('e.namespace', '=', "{$table}.namespace")
376 376
                         ->on('e.group', '=', "{$table}.group")
377 377
                         ->on('e.item', '=', "{$table}.item");
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         return $this->database->table("$table as $table")
477 477
             ->select("$table.id")
478 478
             ->leftJoin(
479
-                "$table as e", function (JoinClause $query) use ($table, $locale) {
479
+                "$table as e", function(JoinClause $query) use ($table, $locale) {
480 480
                     $query->on('e.namespace', '=', "$table.namespace")
481 481
                         ->on('e.group', '=', "$table.group")
482 482
                         ->on('e.item', '=', "$table.item")
Please login to merge, or discard this patch.
src/Routes/ResourceRegistrar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         // Remove segments from group prefix that are equal to one of the available locales:
43 43
         $groupSegments = explode('/', $this->router->getLastGroupPrefix());
44 44
         $groupSegments = array_filter(
45
-            $groupSegments, function ($segment) use ($availableLocales) {
45
+            $groupSegments, function($segment) use ($availableLocales) {
46 46
                 return !in_array($segment, $availableLocales);
47 47
             }
48 48
         );
Please login to merge, or discard this patch.
src/Tokens/GoogleTokenGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     private function unsignedRightShift($a, $b)
113 113
     {
114 114
         if ($b >= 32 || $b < -32) {
115
-            $m = (int)($b / 32);
115
+            $m = (int) ($b / 32);
116 116
             $b = $b - ($m * 32);
117 117
         }
118 118
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     private function JS_charCodeAt($str, $index)
148 148
     {
149 149
         $utf16 = mb_convert_encoding($str, 'UTF-16LE', 'UTF-8');
150
-        return ord($utf16[$index*2]) + (ord($utf16[$index*2+1]) << 8);
150
+        return ord($utf16[$index * 2]) + (ord($utf16[$index * 2 + 1]) << 8);
151 151
     }
152 152
 
153 153
     /**
@@ -160,6 +160,6 @@  discard block
 block discarded – undo
160 160
     private function JS_length($str)
161 161
     {
162 162
         $utf16 = mb_convert_encoding($str, 'UTF-16LE', 'UTF-8');
163
-        return strlen($utf16)/2;
163
+        return strlen($utf16) / 2;
164 164
     }
165 165
 }
Please login to merge, or discard this patch.
database/migrations/2014_01_14_005015_create_translations_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     {
16 16
         // if (!Schema::hasTable('translations')) {
17 17
             Schema::create(
18
-                'translations', function (Blueprint $table) {
18
+                'translations', function(Blueprint $table) {
19 19
                     $table->increments('id');
20 20
                     $table->string('locale', 10);
21 21
                     $table->string('namespace')->default('*');
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         // if (!Schema::hasTable('model_translations')) {
45 45
         Schema::create(
46
-            'model_translations', function (Blueprint $table) {
46
+            'model_translations', function(Blueprint $table) {
47 47
                 $table->increments('id');
48 48
 
49 49
                 $table->string('entity_id');
Please login to merge, or discard this patch.
database/migrations/2013_07_25_145958_create_sitec_translations_table.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         //     } 
20 20
         if (!Schema::hasTable('countries')) {
21 21
             Schema::create(
22
-                'countries', function (Blueprint $table) {
22
+                'countries', function(Blueprint $table) {
23 23
                     $table->string('code')->unique();
24 24
                     $table->primary('code');
25 25
                     $table->string('name');
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         }
32 32
         if (!Schema::hasTable('languages')) {
33 33
             Schema::create(
34
-                'languages', function (Blueprint $table) {
34
+                'languages', function(Blueprint $table) {
35 35
                     $table->engine = 'InnoDB';
36 36
                     $table->string('code')->unique();
37 37
                     $table->primary('code');
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
         }
48 48
         if (!Schema::hasTable('locales')) {
49 49
             Schema::create(
50
-                'locales', function (Blueprint $table) {
50
+                'locales', function(Blueprint $table) {
51 51
                     $table->string('language_code');
52 52
                     $table->string('country_code')->nullable();
53 53
                 
54
-                    $table->primary(['language_code','country_code']);
54
+                    $table->primary(['language_code', 'country_code']);
55 55
 
56 56
                     $table->foreign('language_code')->references('code')->on('languages');
57 57
                     $table->foreign('country_code')->references('code')->on('countries');
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $langs = \Illuminate\Support\Facades\Config::get('translation.countries');
87 87
         if (!empty($langs)) {
88 88
             $class = \Illuminate\Support\Facades\Config::get('translation.models.country');
89
-            foreach($langs as $code=>$name) {
89
+            foreach ($langs as $code=>$name) {
90 90
                 $language = new $class;
91 91
                 $language->name = $name;
92 92
                 $language->code = $code;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $langs = \Illuminate\Support\Facades\Config::get('translation.locales');
101 101
         if (!empty($langs)) {
102 102
             $class = \Illuminate\Support\Facades\Config::get('translation.models.language');
103
-            foreach($langs as $code=>$name) {
103
+            foreach ($langs as $code=>$name) {
104 104
                 $language = new $class;
105 105
                 $language->name = $name;
106 106
                 $language->code = $code;
Please login to merge, or discard this patch.
src/Repositories/LangRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 'name' => utf8_decode(\Locale::getDisplayName($key, $inLocale)),
80 80
                 'region' => utf8_decode(\Locale::getDisplayRegion($key, $inLocale)),
81 81
                 'language' => utf8_decode(\Locale::getDisplayLanguage($key, $inLocale)),
82
-                'class' => 'flag-icon flag-icon-' . strtolower(\Locale::getRegion($key))
82
+                'class' => 'flag-icon flag-icon-'.strtolower(\Locale::getRegion($key))
83 83
             ];
84 84
         }
85 85
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         //        }
106 106
 
107 107
 
108
-        if (session('language')!==null) {
108
+        if (session('language') !== null) {
109 109
             //Config::set('app.locale', session('language'));
110 110
             return current(self::get(session('language')));
111 111
         }
Please login to merge, or discard this patch.
src/Traits/HasTranslations.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getAttributeValue($key)
67 67
     {
68
-        if (! $this->isTranslatableAttribute($key)) {
68
+        if (!$this->isTranslatableAttribute($key)) {
69 69
             return parent::getAttributeValue($key);
70 70
         }
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     public function setAttribute($key, $value)
76 76
     {
77 77
         // Pass arrays and untranslatable attributes to the parent method.
78
-        if (! $this->isTranslatableAttribute($key) || is_array($value)) {
78
+        if (!$this->isTranslatableAttribute($key) || is_array($value)) {
79 79
             return parent::setAttribute($key, $value);
80 80
         }
81 81
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
         if ($key !== null) {
120 120
             $this->guardAgainstNonTranslatableAttribute($key);
121 121
 
122
-            return array_filter(json_decode($this->getAttributes()[$key] ?? '' ?: '{}', true) ?: [], function ($value) {
122
+            return array_filter(json_decode($this->getAttributes()[$key] ?? '' ?: '{}', true) ?: [], function($value) {
123 123
                 return $value !== null && $value !== '';
124 124
             });
125 125
         }
126 126
 
127
-        return array_reduce($this->getTranslatableAttributes(), function ($result, $item) {
127
+        return array_reduce($this->getTranslatableAttributes(), function($result, $item) {
128 128
             $result[$item] = $this->getTranslations($item);
129 129
 
130 130
             return $result;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
     public function forgetAllTranslations(string $locale): self
185 185
     {
186
-        collect($this->getTranslatableAttributes())->each(function (string $attribute) use ($locale) {
186
+        collect($this->getTranslatableAttributes())->each(function(string $attribute) use ($locale) {
187 187
             $this->forgetTranslation($attribute, $locale);
188 188
         });
189 189
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
     protected function guardAgainstNonTranslatableAttribute(string $key)
211 211
     {
212
-        if (! $this->isTranslatableAttribute($key)) {
212
+        if (!$this->isTranslatableAttribute($key)) {
213 213
             throw AttributeIsNotTranslatable::make($key, $this);
214 214
         }
215 215
     }
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
             return $locale;
221 221
         }
222 222
 
223
-        if (! $useFallbackLocale) {
223
+        if (!$useFallbackLocale) {
224 224
             return $locale;
225 225
         }
226 226
 
227
-        if (! is_null($fallbackLocale = config('translatable.fallback_locale'))) {
227
+        if (!is_null($fallbackLocale = config('translatable.fallback_locale'))) {
228 228
             return $fallbackLocale;
229 229
         }
230 230
 
231
-        if (! is_null($fallbackLocale = config('app.fallback_locale'))) {
231
+        if (!is_null($fallbackLocale = config('app.fallback_locale'))) {
232 232
             return $fallbackLocale;
233 233
         }
234 234
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     public function getTranslationsAttribute(): array
260 260
     {
261 261
         return collect($this->getTranslatableAttributes())
262
-            ->mapWithKeys(function (string $key) {
262
+            ->mapWithKeys(function(string $key) {
263 263
                 return [$key => $this->getTranslations($key)];
264 264
             })
265 265
             ->toArray();
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function asObject()
300 300
     {
301
-        if (! is_null(request('lang')) && request('lang') !== config('cms.default-language', 'en')) {
301
+        if (!is_null(request('lang')) && request('lang') !== config('cms.default-language', 'en')) {
302 302
             return $this->translationData(request('lang'));
303 303
         }
304 304
 
Please login to merge, or discard this patch.
src/Traits/Translatable.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
         }
60 60
 
61 61
         $query->with(
62
-            ['translations' => function (Relation $query) use ($locale, $fallback) {
62
+            ['translations' => function(Relation $query) use ($locale, $fallback) {
63 63
                 $query->where(
64
-                    function ($q) use ($locale, $fallback) {
64
+                    function($q) use ($locale, $fallback) {
65 65
                         $q->where('locale', $locale);
66 66
 
67 67
                         if ($fallback !== false) {
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
         }
93 93
 
94 94
         $query->with(
95
-            ['translations' => function (Relation $query) use ($locales, $fallback) {
95
+            ['translations' => function(Relation $query) use ($locales, $fallback) {
96 96
                 if (is_null($locales)) {
97 97
                     return;
98 98
                 }
99 99
 
100 100
                 $query->where(
101
-                    function ($q) use ($locales, $fallback) {
101
+                    function($q) use ($locales, $fallback) {
102 102
                         if (is_array($locales)) {
103 103
                             $q->whereIn('locale', $locales);
104 104
                         } else {
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
                 ->where('column_name', $field)
295 295
                 ->where('value', $operator, $value)
296 296
                 ->when(
297
-                    !is_null($locales), function ($query) use ($locales) {
297
+                    !is_null($locales), function($query) use ($locales) {
298 298
                         return $query->whereIn('locale', $locales);
299 299
                     }
300 300
                 )
301 301
             ->pluck('foreign_key')
302 302
         )->when(
303
-            $default, function ($query) use ($field, $operator, $value) {
303
+            $default, function($query) use ($field, $operator, $value) {
304 304
                 return $query->orWhere($field, $operator, $value);
305 305
             }
306 306
         );
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $this->translations()
330 330
             ->whereIn('column_name', $attributes)
331 331
             ->when(
332
-                !is_null($locales), function ($query) use ($locales) {
332
+                !is_null($locales), function($query) use ($locales) {
333 333
                     $method = is_array($locales) ? 'whereIn' : 'where';
334 334
 
335 335
                     return $query->$method('locale', $locales);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $this->translations()
344 344
             ->where('column_name', $attribute)
345 345
             ->when(
346
-                !is_null($locales), function ($query) use ($locales) {
346
+                !is_null($locales), function($query) use ($locales) {
347 347
                     $method = is_array($locales) ? 'whereIn' : 'where';
348 348
 
349 349
                     return $query->$method('locale', $locales);
Please login to merge, or discard this patch.