Completed
Push — master ( d59a3b...064224 )
by Ricardo
13:04
created
src/Observers/Localize.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@
 block discarded – undo
81 81
             $model->setAttribute('locale_group', Str::random());
82 82
         }
83 83
 
84
-        if (Schema::hasColumn($model->getTable(), 'language_code') && empty($model->language_code)){
84
+        if (Schema::hasColumn($model->getTable(), 'language_code') && empty($model->language_code)) {
85 85
             $model->language_code = Translation::getLanguageCode();
86 86
         }
87 87
 
88
-        if (Schema::hasColumn($model->getTable(), 'country_code') && empty($model->country_code)){
88
+        if (Schema::hasColumn($model->getTable(), 'country_code') && empty($model->country_code)) {
89 89
             $model->language_code = Translation::getCountryCode();
90 90
         }
91 91
 
Please login to merge, or discard this patch.
src/Services/Translation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         try {
239 239
             return app()->getLocale();
240 240
         } catch (Exception $e) {
241
-            if($this->request->request->has('locale')) {
241
+            if ($this->request->request->has('locale')) {
242 242
                 return strtolower($this->request->input('locale'));
243 243
             }
244 244
             if ($this->request->hasHeader('locale')) {
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
     {
766 766
         $actual = $this->getActualLanguage();
767 767
         $languages = $this->getAllLanguages();
768
-        if (empty($languages) || count($languages)<=1) {
768
+        if (empty($languages) || count($languages) <= 1) {
769 769
             return '';
770 770
         }
771 771
 
Please login to merge, or discard this patch.
src/Services/UriLocalizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
      */
110 110
     protected function pathFromParsedUrl($parsedUrl)
111 111
     {
112
-        $path = '/' . implode('/', $parsedUrl['segments']);
112
+        $path = '/'.implode('/', $parsedUrl['segments']);
113 113
         if ($parsedUrl['query']) {
114 114
             $path .= "?{$parsedUrl['query']}";
115 115
         }
Please login to merge, or discard this patch.
src/Services/GoogleTranslate.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
         'client'   => 'webapp',
57 57
         'hl'       => 'en',
58 58
         'dt'       => [
59
-            't',   // Translate
60
-            'bd',  // Full translate with synonym ($bodyArray[1])
61
-            'at',  // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word)
62
-            'ex',  // Example part ($bodyArray[13])
63
-            'ld',  // I don't know ($bodyArray[8])
64
-            'md',  // Definition part with example ($bodyArray[12])
59
+            't', // Translate
60
+            'bd', // Full translate with synonym ($bodyArray[1])
61
+            'at', // Other translate ($bodyArray[5] - in google translate page this shows when click on translated word)
62
+            'ex', // Example part ($bodyArray[13])
63
+            'ld', // I don't know ($bodyArray[8])
64
+            'md', // Definition part with example ($bodyArray[12])
65 65
             'qca', // I don't know ($bodyArray[8])
66
-            'rw',  // Read also part ($bodyArray[14])
67
-            'rm',  // I don't know
66
+            'rw', // Read also part ($bodyArray[14])
67
+            'rm', // I don't know
68 68
             'ss'   // Full synonym ($bodyArray[11])
69 69
         ],
70 70
         'sl'       => null, // Source language
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         } else {
271 271
             if (is_array($responseArray[0])) {
272 272
                 return (string) array_reduce(
273
-                    $responseArray[0], function ($carry, $item) {
273
+                    $responseArray[0], function($carry, $item) {
274 274
                         $carry .= $item[0];
275 275
                         return $carry;
276 276
                     }
Please login to merge, or discard this patch.
src/Services/Translator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
         $this->model->setRelation(
290 290
             'translations', $translations->filter(
291
-                function ($translation) use ($key, $locale) {
291
+                function($translation) use ($key, $locale) {
292 292
                     return $translation->column_name != $key && $translation->locale != $locale;
293 293
                 }
294 294
             )
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
     public function jsonSerialize()
330 330
     {
331 331
         return array_map(
332
-            function ($array) {
332
+            function($array) {
333 333
                 return $array['value'];
334 334
             }, $this->getRawAttributes()
335 335
         );
Please login to merge, or discard this patch.
src/TranslationServiceProvider.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
     {
54 54
         Schema::defaultStringLength(191);
55 55
 
56
-        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations/');
56
+        $this->loadMigrationsFrom(__DIR__.'/../database/migrations/');
57 57
         $this->publishes(
58 58
             [
59
-            __DIR__ . '/../config/translator.php' => config_path('translator.php'),
60
-            __DIR__ . '/../config/translation.php' => config_path('translation.php'),
59
+            __DIR__.'/../config/translator.php' => config_path('translator.php'),
60
+            __DIR__.'/../config/translation.php' => config_path('translation.php'),
61 61
             ]
62 62
         );
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
          */
69 69
         Route::group([
70 70
             'namespace' => '\Translation\Http\Controllers',
71
-        ], function (/**$router**/) {
71
+        ], function(/**$router**/) {
72 72
             require __DIR__.'/../routes/web.php';
73 73
         });
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
          * Provider Antigo
80 80
          */
81 81
         Blade::directive(
82
-            't', function ($args) {
82
+            't', function($args) {
83 83
                 return "<?php echo App::make('translation')->translate{$args}; ?>";
84 84
             }
85 85
         );
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function register()
97 97
     {
98
-        $this->mergeConfigFrom(__DIR__ . '/../config/translator.php', 'translator');
99
-        $this->mergeConfigFrom(__DIR__ . '/../config/translation.php', 'translation');
98
+        $this->mergeConfigFrom(__DIR__.'/../config/translator.php', 'translator');
99
+        $this->mergeConfigFrom(__DIR__.'/../config/translation.php', 'translation');
100 100
 
101 101
         parent::register();
102 102
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
         // Bind translation to the IoC.
106 106
         $this->app->bind(
107
-            'translation', function (Application $app) {
107
+            'translation', function(Application $app) {
108 108
                 return new \Translation\Services\Translation($app);
109 109
             }
110 110
         );
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $app = $this->app;
154 154
         $this->app->singleton(
155
-            'translation.loader', function ($app) {
155
+            'translation.loader', function($app) {
156 156
                 $defaultLocale = $app['config']->get('app.locale');
157 157
                 $loader        = null;
158 158
                 $source        = $app['config']->get('translator.source');
159 159
 
160 160
                 switch ($source) {
161 161
                 case 'mixed':
162
-                    $laravelFileLoader = new LaravelFileLoader($app['files'], $app->basePath() . '/resources/lang');
162
+                    $laravelFileLoader = new LaravelFileLoader($app['files'], $app->basePath().'/resources/lang');
163 163
                     $fileLoader        = new FileLoader($defaultLocale, $laravelFileLoader);
164 164
                     $databaseLoader    = new DatabaseLoader($defaultLocale, $app->make(TranslationRepository::class));
165 165
                     $loader            = new MixedLoader($defaultLocale, $fileLoader, $databaseLoader);
166 166
 break;
167 167
                 case 'mixed_db':
168
-                    $laravelFileLoader = new LaravelFileLoader($app['files'], $app->basePath() . '/resources/lang');
168
+                    $laravelFileLoader = new LaravelFileLoader($app['files'], $app->basePath().'/resources/lang');
169 169
                     $fileLoader        = new FileLoader($defaultLocale, $laravelFileLoader);
170 170
                     $databaseLoader    = new DatabaseLoader($defaultLocale, $app->make(TranslationRepository::class));
171 171
                     $loader            = new MixedLoader($defaultLocale, $databaseLoader, $fileLoader);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                     $loader = new DatabaseLoader($defaultLocale, $app->make(TranslationRepository::class));
175 175
 break;
176 176
                 default:case 'files':
177
-                        $laravelFileLoader = new LaravelFileLoader($app['files'], $app->basePath() . '/resources/lang');
177
+                        $laravelFileLoader = new LaravelFileLoader($app['files'], $app->basePath().'/resources/lang');
178 178
                         $loader            = new FileLoader($defaultLocale, $laravelFileLoader);
179 179
 break;
180 180
                 }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     public function registerCacheRepository()
195 195
     {
196 196
         $this->app->singleton(
197
-            'translation.cache.repository', function ($app) {
197
+            'translation.cache.repository', function($app) {
198 198
                 $cacheStore = $app['cache']->getStore();
199 199
                 return CacheRepositoryFactory::make($cacheStore, $app['config']->get('translator.cache.suffix'));
200 200
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $defaultLocale         = $app['config']->get('app.locale');
213 213
         $languageRepository    = $app->make(LanguageRepository::class);
214 214
         $translationRepository = $app->make(TranslationRepository::class);
215
-        $translationsPath      = $app->basePath() . '/resources/lang';
215
+        $translationsPath      = $app->basePath().'/resources/lang';
216 216
         $command               = new FileLoaderCommand($languageRepository, $translationRepository, $app['files'], $translationsPath, $defaultLocale);
217 217
 
218 218
         $this->app['command.translator:load'] = $command;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     protected function bootTranslatorCollectionMacros()
238 238
     {
239 239
         Collection::macro(
240
-            'translate', function () {
240
+            'translate', function() {
241 241
                 $transtors = [];
242 242
 
243 243
                 foreach ($this->all() as $item) {
Please login to merge, or discard this patch.
src/Template/Localize.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         $class = $this->model; // Must be a local var to test
90 90
 
91 91
         // There aren't multiple locales specified
92
-        if (count(\Illuminate\Support\Facades\Config::get('site.site.locales')) <= 1 ) { return true;
92
+        if (count(\Illuminate\Support\Facades\Config::get('site.site.locales')) <= 1) { return true;
93 93
         }
94 94
 
95 95
         // We're editing a model with no locale attribute
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         }
98 98
 
99 99
         // The model was explicitly disabled
100
-        if (!property_exists($class, 'localizable') || $class::$localizable === false ) {
100
+        if (!property_exists($class, 'localizable') || $class::$localizable === false) {
101 101
             return true;
102 102
         }
103 103
 
Please login to merge, or discard this patch.