Passed
Push — master ( 1230d1...ab986e )
by Francis
01:11
created
libraries/GMail.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
   const TOKEN_URL = 'https://accounts.google.com/o/oauth2/token';
12 12
   private $clientId;
13 13
 
14
-  function __construct($params=null) {
14
+  function __construct($params = null) {
15 15
     get_instance()->load->splint('francis94c/ci-gmail', '%curl');
16 16
     $this->clientId = $params['client_id'] ?? $this->clientId;
17 17
   }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
    *       config items]
21 21
    * @param array $config Associative Config Array.
22 22
    */
23
-  public function init(array $config=null):void {
23
+  public function init(array $config = null):void {
24 24
     $this->clientId = $config['client_id'] ?? $this->clientId;
25 25
   }
26 26
   /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
    * @param  string $responseType Response type. 'code' by default.
33 33
    * @return string               Authorize URL
34 34
    */
35
-  public function getAuthorizeUrl(string $scope, string $redirectUri='urn:ietf:wg:oauth:2.0:oob', string $responseType='code', string $accessType='offline'):string {
35
+  public function getAuthorizeUrl(string $scope, string $redirectUri = 'urn:ietf:wg:oauth:2.0:oob', string $responseType = 'code', string $accessType = 'offline'):string {
36 36
     if ($scope == null) throw new Exception("GMail scope cannot be null");
37
-    return self::AUTH_URL . build_url_query([
37
+    return self::AUTH_URL.build_url_query([
38 38
       'client_id'     => $this->clientId,
39 39
       'redirect_uri'  => $redirectUri,
40 40
       'scope'         => $scope,
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
    * @param  string $code [description]
48 48
    * @return [type]       [description]
49 49
    */
50
-  public function getToken(string $code):?array {
50
+  public function getToken(string $code): ?array {
51 51
 
52 52
   }
53 53
   /**
54 54
    * [getClientId Get Client ID.]
55 55
    * @return null|string Client ID.
56 56
    */
57
-  public function getClientId():?string {
57
+  public function getClientId(): ?string {
58 58
     return $this->clientId;
59 59
   }
60 60
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
    * @return string               Authorize URL
34 34
    */
35 35
   public function getAuthorizeUrl(string $scope, string $redirectUri='urn:ietf:wg:oauth:2.0:oob', string $responseType='code', string $accessType='offline'):string {
36
-    if ($scope == null) throw new Exception("GMail scope cannot be null");
36
+    if ($scope == null) {
37
+      throw new Exception("GMail scope cannot be null");
38
+    }
37 39
     return self::AUTH_URL . build_url_query([
38 40
       'client_id'     => $this->clientId,
39 41
       'redirect_uri'  => $redirectUri,
Please login to merge, or discard this patch.
helpers/curl_helper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 defined('BASEPATH') OR exit('No direct script access allowed');
4 4
 
5 5
 if (!function_exists('build_url_query')) {
6
-  function build_url_query(array $params, bool $urlEncode=true) {
6
+  function build_url_query(array $params, bool $urlEncode = true) {
7 7
     $queryString = '?';
8
-    foreach($params as $key => $val) {
8
+    foreach ($params as $key => $val) {
9 9
       $queryString .= $key."=".($urlEncode ? rawurlencode($val) : $val)."&";
10 10
     }
11 11
     return substr($queryString, 0, strlen($queryString) - 1);
Please login to merge, or discard this patch.