Completed
Push — master ( 5118b9...50529d )
by Aitor Riba
01:45
created
src/Migrations/2016_11_04_135240_laralang_translations.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('laralang_translations', function (Blueprint $table) {
16
+        Schema::create('laralang_translations', function(Blueprint $table) {
17 17
             $table->increments('id');
18 18
             $table->string('translator');
19 19
             $table->string('string');
Please login to merge, or discard this patch.
src/Builder/Translation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
         if ($this->debug === true) {
118 118
             $this->translation = "<font style='color:#00CC00;'>Translation loaded from DB</font>";
119 119
         } else {
120
-            $this->translation = ($existing[0]->translation);
120
+            $this->translation = ($existing[ 0 ]->translation);
121 121
         }
122 122
 
123 123
         return true;
Please login to merge, or discard this patch.
src/Builder/ApertiumTrans.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 
22 22
             // Checking response status
23 23
 
24
-            if ($data['responseStatus'] != 200) {
24
+            if ($data[ 'responseStatus' ] != 200) {
25 25
                 if ($this->debug === true) {
26
-                    $this->translation = "<font style='color:red;'>Error ".$data['responseStatus'].': '.$data['responseDetails'].'</font>';
26
+                    $this->translation = "<font style='color:red;'>Error ".$data[ 'responseStatus' ].': '.$data[ 'responseDetails' ].'</font>';
27 27
                 }
28 28
 
29 29
                 return;
30 30
             }
31 31
 
32
-            $transObtained = $data['responseData']['translatedText'];
32
+            $transObtained = $data[ 'responseData' ][ 'translatedText' ];
33 33
 
34 34
             $this->translation = ucfirst(strtolower(trim(str_replace('*', ' ', $transObtained))));
35 35
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 $words = explode(' ', $transObtained);
41 41
                 foreach ($words as $word) {
42 42
                     if ($word != '') {
43
-                        if ($word[0] == '*') {
43
+                        if ($word[ 0 ] == '*') {
44 44
                             $errors = $errors.substr($word, 1).', ';
45 45
                         }
46 46
                     }
Please login to merge, or discard this patch.
src/Builder/MymemoryTrans.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
              $urldata = file_get_contents("http://$host/get?q=$urlString&langpair=$this->from|$this->to");
20 20
              $data = json_decode($urldata, true);
21 21
 
22
-             if ($data['responseStatus'] != 200) {
22
+             if ($data[ 'responseStatus' ] != 200) {
23 23
                  if ($this->debug == true) {
24
-                     if ($data['responseStatus'] == 403) {
25
-                         $details = ($data['responseDetails']);
24
+                     if ($data[ 'responseStatus' ] == 403) {
25
+                         $details = ($data[ 'responseDetails' ]);
26 26
                      } else {
27
-                         $details = $data['responseDetails'];
27
+                         $details = $data[ 'responseDetails' ];
28 28
                      }
29 29
                      $this->translation = "<font style='color:red;'>Error ".$data->responseStatus.': '.$details.'</font>';
30 30
                  }
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
              }
34 34
 
35 35
              // Checking if any translation provides from 24aitor to use it
36
-             foreach ($data['matches']  as $match) {
37
-                 if ($match['last-updated-by'] == '24aitor') {
38
-                     $this->translation = $match['translation'];
36
+             foreach ($data[ 'matches' ]  as $match) {
37
+                 if ($match[ 'last-updated-by' ] == '24aitor') {
38
+                     $this->translation = $match[ 'translation' ];
39 39
                      $this->checkSave();
40 40
 
41 41
                      return;
42 42
                  }
43 43
              }
44 44
 
45
-             $this->translation = $data['responseData']['translatedText'];
45
+             $this->translation = $data[ 'responseData' ][ 'translatedText' ];
46 46
              $this->checkSave();
47 47
 
48 48
              return;
Please login to merge, or discard this patch.
src/Builder/GoogleTrans.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
              $tr = substr($tr, 3, -6);
22 22
              $tr = $tr.'["';
23 23
              $tr = explode('],[', $tr);
24
-             $trans = [];
24
+             $trans = [ ];
25 25
              foreach ($tr as $tran) {
26 26
                  $transl = explode('","', $tran);
27
-                 array_push($trans, str_replace('\"', '"', ucfirst(substr($transl[0], 1))));
27
+                 array_push($trans, str_replace('\"', '"', ucfirst(substr($transl[ 0 ], 1))));
28 28
              }
29 29
              $this->translation = implode(' ', $trans);
30 30
              $this->checkSave();
Please login to merge, or discard this patch.
src/Controllers/LaralangController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function login(Request $request)
23 23
     {
24
-        session(['laralang.password' => Crypt::encrypt($request->input('password'))]);
24
+        session([ 'laralang.password' => Crypt::encrypt($request->input('password')) ]);
25 25
         if (Crypt::decrypt(session('laralang.password')) != config('laralang.default.password')) {
26 26
             return redirect(Route('laralang::login'))
27 27
             ->with('status', 'Invalid password');
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function showTranslationsFilter()
46 46
     {
47
-        return view('laralang::filter', ['languagesFrom' => Laralang::fromLanguages(), 'languagesTo' => Laralang::toLanguages()]);
47
+        return view('laralang::filter', [ 'languagesFrom' => Laralang::fromLanguages(), 'languagesTo' => Laralang::toLanguages() ]);
48 48
     }
49 49
 
50 50
     public function translationsFilter(Request $request)
51 51
     {
52
-        return redirect()->route('laralang::filterFromTo', [$request->from_lang, $request->to_lang]);
52
+        return redirect()->route('laralang::filterFromTo', [ $request->from_lang, $request->to_lang ]);
53 53
     }
54 54
 
55 55
     public function showTranslationsFiltered($from_lang, $to_lang)
56 56
     {
57
-        return view('laralang::translations', ['from_lang' => $from_lang, 'to_lang' => $to_lang]);
57
+        return view('laralang::translations', [ 'from_lang' => $from_lang, 'to_lang' => $to_lang ]);
58 58
     }
59 59
 
60 60
     public function api()
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public function apiTranslate(Request $request)
66 66
     {
67 67
         $translatedText = Laralang::trans($request->string)->to($request->to);
68
-        return ['translatedText' => strval($translatedText)];
68
+        return [ 'translatedText' => strval($translatedText) ];
69 69
     }
70 70
 
71 71
 
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
         } elseif ($to_lang == 'all') {
78 78
 
79 79
             //return translation where from_lang == $from
80
-            return DB_Translation::where([['from_lang', $from_lang]])->get();
80
+            return DB_Translation::where([ [ 'from_lang', $from_lang ] ])->get();
81 81
         } elseif ($from_lang == 'all') {
82 82
 
83 83
             //return translation where to_lang == $to
84
-            return DB_Translation::where([['to_lang', $to_lang]])->get();
84
+            return DB_Translation::where([ [ 'to_lang', $to_lang ] ])->get();
85 85
         } else {
86 86
 
87 87
             //return translation where from_lang == $from and to_lang == $to
88
-            return DB_Translation::where([['from_lang', $from_lang], ['to_lang', $to_lang]])->get();
88
+            return DB_Translation::where([ [ 'from_lang', $from_lang ], [ 'to_lang', $to_lang ] ])->get();
89 89
         }
90 90
     }
91 91
 
Please login to merge, or discard this patch.
src/Routes/web.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (config('laralang.default.routes')) {
4
-    Route::group(['middleware' => 'web', 'as' => 'laralang::', 'prefix' => config('laralang.default.prefix'), 'namespace' => 'Aitor24\Laralang\Controllers'], function () {
4
+    Route::group([ 'middleware' => 'web', 'as' => 'laralang::', 'prefix' => config('laralang.default.prefix'), 'namespace' => 'Aitor24\Laralang\Controllers' ], function() {
5 5
         Route::get('/login', 'LaralangController@showLogin')->name('login');
6 6
         Route::post('/login', 'LaralangController@login');
7 7
         if (config('laralang.default.api')) {
8
-            Route::group(['middleware' => ['throttle:5000,1', 'bindings']], function () {
8
+            Route::group([ 'middleware' => [ 'throttle:5000,1', 'bindings' ] ], function() {
9 9
                 Route::post('/api/translate', 'LaralangController@apiTranslate')->name('apiTranslate');
10 10
             });
11 11
         }
12
-        Route::group(['middleware' => 'laralang.middleware'], function () {
13
-            Route::get('/', function () {
12
+        Route::group([ 'middleware' => 'laralang.middleware' ], function() {
13
+            Route::get('/', function() {
14 14
                 return redirect(Route('laralang::translations'));
15 15
             })->name('home');
16 16
             Route::get('/translations', 'LaralangController@showTranslations')->name('translations');
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             Route::post('/edit', 'LaralangController@editTranslation');
26 26
             Route::get('/logout', 'LaralangController@logout')->name('logout');
27 27
 
28
-            Route::group(['middleware' => ['throttle:5000,1', 'bindings']], function () {
28
+            Route::group([ 'middleware' => [ 'throttle:5000,1', 'bindings' ] ], function() {
29 29
                 Route::get('/api', 'LaralangController@api')->name('api');
30 30
                 Route::get('/api/filter/from/{from_lang}/to/{to_lang}', 'LaralangController@apiFilterFromTo')->name('apiFilterFromTo');
31 31
             });
Please login to merge, or discard this patch.
src/Views/translations.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@
 block discarded – undo
250 250
 
251 251
 	$('#edit').click(function() {
252 252
 		var trans_id = $('.trans-id').val();
253
-		<?php $url_route =  Laralang::checkRoute('laralang::editTrans');
253
+		<?php $url_route = Laralang::checkRoute('laralang::editTrans');
254 254
 		?>
255 255
 		$.ajax({
256 256
 			type: "POST",
Please login to merge, or discard this patch.
src/Builder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public static function trans($string)
21 21
     {
22 22
         $translator = config('laralang.default.translator');
23
-        if (!in_array(config('laralang.default.translator'), ['apertium', 'mymemory', 'google'])) {
23
+        if (!in_array(config('laralang.default.translator'), [ 'apertium', 'mymemory', 'google' ])) {
24 24
             return "<font style='color:red;'>Laralang doesn't support $translator translator. Check config</font>";
25 25
         } else {
26 26
             if (config('laralang.default.translator') == 'mymemory') {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public static function toLanguages()
42 42
     {
43
-        $locales = [];
43
+        $locales = [ ];
44 44
         $translations = DB_Translation::distinct()->select('to_lang')->get();
45 45
         foreach ($translations as $object) {
46 46
             array_push($locales, $object->to_lang);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public static function fromLanguages()
58 58
     {
59
-        $locales = [];
59
+        $locales = [ ];
60 60
         $translations = DB_Translation::distinct()->select('from_lang')->get();
61 61
         foreach ($translations as $object) {
62 62
             array_push($locales, $object->from_lang);
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
     {
129 129
         if (config('laralang.default.https')) {
130 130
             if (isset($routeArgs)) {
131
-                return secure_url(URL::route($routeName,$routeArgs,false));
131
+                return secure_url(URL::route($routeName, $routeArgs, false));
132 132
             }
133
-            return secure_url(URL::route($routeName,[],false));
133
+            return secure_url(URL::route($routeName, [ ], false));
134 134
         }
135 135
         if (isset($routeArgs)) {
136 136
             return route($routeName, $routeArgs);
Please login to merge, or discard this patch.