Completed
Pull Request — master (#15)
by Aitor Riba
03:34 queued 01:58
created
src/Builder/GoogleTrans.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,31 +5,31 @@
 block discarded – undo
5 5
 class GoogleTrans extends Translation
6 6
 {
7 7
     /**
8
-      * Get translation from Google.
9
-      */
10
-     public function main()
11
-     {
12
-         $host = 'translate.googleapis.com';
8
+     * Get translation from Google.
9
+     */
10
+        public function main()
11
+        {
12
+            $host = 'translate.googleapis.com';
13 13
 
14
-         // Check if host is online.
15
-         if ($this->checkHost($host)) {
14
+            // Check if host is online.
15
+            if ($this->checkHost($host)) {
16 16
 
17
-             // Host online
18
-             $urlString = urlencode($this->string);
19
-             $urldata = file_get_contents("https://translate.googleapis.com/translate_a/single?client=gtx&sl=$this->from&tl=$this->to&dt=t&q=$urlString");
20
-             $tr = $urldata;
21
-             $tr = substr($tr, 3, -6);
22
-             $tr = $tr.'["';
23
-             $tr = explode('],[', $tr);
24
-             $trans = [];
25
-             foreach ($tr as $tran) {
26
-                 $transl = explode('","', $tran);
27
-                 array_push($trans, str_replace('\"', '"', ucfirst(substr($transl[0], 1))));
28
-             }
29
-             $this->translation = implode(' ', $trans);
30
-             $this->checkSave();
17
+                // Host online
18
+                $urlString = urlencode($this->string);
19
+                $urldata = file_get_contents("https://translate.googleapis.com/translate_a/single?client=gtx&sl=$this->from&tl=$this->to&dt=t&q=$urlString");
20
+                $tr = $urldata;
21
+                $tr = substr($tr, 3, -6);
22
+                $tr = $tr.'["';
23
+                $tr = explode('],[', $tr);
24
+                $trans = [];
25
+                foreach ($tr as $tran) {
26
+                    $transl = explode('","', $tran);
27
+                    array_push($trans, str_replace('\"', '"', ucfirst(substr($transl[0], 1))));
28
+                }
29
+                $this->translation = implode(' ', $trans);
30
+                $this->checkSave();
31 31
 
32
-             return;
33
-         }
34
-     }
32
+                return;
33
+            }
34
+        }
35 35
 }
Please login to merge, or discard this 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.