Passed
Push — master ( 3e41fe...15a2ff )
by Francis
01:32
created
libraries/GMailUtil.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@
 block discarded – undo
16 16
   }
17 17
 
18 18
   function __invoke(string $url, array $header=[], array $body=null):array {
19
-    if ($body != null) $body = json_encode($body);
19
+    if ($body != null) {
20
+      $body = json_encode($body);
21
+    }
20 22
 
21 23
     $ch = curl_init($url);
22 24
 
Please login to merge, or discard this patch.
libraries/GMail.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
   function __construct($params=null) {
21 21
     get_instance()->load->splint('francis94c/ci-gmail', '%curl');
22
-    if ($params != null) $this->init($params);
22
+    if ($params != null) {
23
+      $this->init($params);
24
+    }
23 25
   }
24 26
 
25 27
   /**
@@ -58,7 +60,9 @@  discard block
 block discarded – undo
58 60
    */
59 61
   public function getAuthorizeUrl(string $scope, string $redirectUri=null, string $responseType='code', string $accessType='offline', bool $prompt=false):string {
60 62
     $redirectUri = $redirectUri ?? $this->redirectUri;
61
-    if ($scope == null) throw new Exception("GMail scope cannot be null");
63
+    if ($scope == null) {
64
+      throw new Exception("GMail scope cannot be null");
65
+    }
62 66
     $params = [
63 67
       'client_id'     => $this->clientId,
64 68
       'redirect_uri'  => $redirectUri,
@@ -66,7 +70,9 @@  discard block
 block discarded – undo
66 70
       'response_type' => $responseType,
67 71
       'access_type'   => $accessType
68 72
     ];
69
-    if ($prompt) $params['prompt'] = 'consent';
73
+    if ($prompt) {
74
+      $params['prompt'] = 'consent';
75
+    }
70 76
     return self::AUTH_URL . build_url_query($params, false);
71 77
   }
72 78
   /**
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
     $response = curl_exec($ch);
102 108
     $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
103 109
     curl_close($ch);
104
-    if ($response !== false) return $this->process_response($code, $response);
110
+    if ($response !== false) {
111
+      return $this->process_response($code, $response);
112
+    }
105 113
     return null;
106 114
   }
107 115
   /**
@@ -135,7 +143,9 @@  discard block
 block discarded – undo
135 143
     $response = curl_exec($ch);
136 144
     $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
137 145
     curl_close($ch);
138
-    if ($response !== false) return $this->process_response($code, $response);
146
+    if ($response !== false) {
147
+      return $this->process_response($code, $response);
148
+    }
139 149
     return null;
140 150
   }
141 151
   /**
@@ -149,7 +159,9 @@  discard block
 block discarded – undo
149 159
       self::API . "$user/profile",
150 160
       ["Authorization: Bearer $this->token"]
151 161
     );
152
-    if ($response !== false) return $this->process_response($code, $response);
162
+    if ($response !== false) {
163
+      return $this->process_response($code, $response);
164
+    }
153 165
     return null;
154 166
   }
155 167
   /**
@@ -183,7 +195,9 @@  discard block
 block discarded – undo
183 195
       ["Authorization: Bearer $this->token"],
184 196
       $body
185 197
     );
186
-    if ($response !== false) return $this->process_response($code, $response);
198
+    if ($response !== false) {
199
+      return $this->process_response($code, $response);
200
+    }
187 201
     return null;
188 202
   }
189 203
   /**
Please login to merge, or discard this patch.