@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | function __invoke(string $url, array $header=[], mixed $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 | |
@@ -26,7 +28,9 @@ discard block |
||
26 | 28 | // Header. |
27 | 29 | $header[] = 'Content-Type: application/json'; |
28 | 30 | $header[] = 'User-Agent: '.$this->userAgent; |
29 | - if ($body != null) $header[] = 'Content-Length: '.strlen($body); |
|
31 | + if ($body != null) { |
|
32 | + $header[] = 'Content-Length: '.strlen($body); |
|
33 | + } |
|
30 | 34 | curl_setopt($ch, CURLOPT_HTTPHEADER, $header); |
31 | 35 | // Request Method and Body. |
32 | 36 | if ($this->method == self::POST) { |
@@ -15,7 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | function __construct($params=null) { |
17 | 17 | get_instance()->load->splint('francis94c/ci-gmail', '%curl'); |
18 | - if ($params != null) $this->init($params); |
|
18 | + if ($params != null) { |
|
19 | + $this->init($params); |
|
20 | + } |
|
19 | 21 | } |
20 | 22 | |
21 | 23 | /** |
@@ -39,7 +41,9 @@ discard block |
||
39 | 41 | */ |
40 | 42 | public function getAuthorizeUrl(string $scope, string $redirectUri=null, string $responseType='code', string $accessType='offline'):string { |
41 | 43 | $redirectUri = $redirectUri ?? $this->redirectUri; |
42 | - if ($scope == null) throw new Exception("GMail scope cannot be null"); |
|
44 | + if ($scope == null) { |
|
45 | + throw new Exception("GMail scope cannot be null"); |
|
46 | + } |
|
43 | 47 | return self::AUTH_URL . build_url_query([ |
44 | 48 | 'client_id' => $this->clientId, |
45 | 49 | 'redirect_uri' => $redirectUri, |
@@ -10,7 +10,9 @@ |
||
10 | 10 | * @return string [description] |
11 | 11 | */ |
12 | 12 | function build_url_query(array $params, bool $urlEncode=true):?string { |
13 | - if ($params == null) return null; |
|
13 | + if ($params == null) { |
|
14 | + return null; |
|
15 | + } |
|
14 | 16 | $queryString = '?'; |
15 | 17 | foreach($params as $key => $val) { |
16 | 18 | $queryString .= $key."=".($urlEncode ? rawurlencode($val) : $val)."&"; |