Completed
Push — master ( 2fa89a...128e80 )
by Ryan
07:18 queued 05:09
created
src/Resources/OAuth2.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 	 * @param string $clientId      The Client ID of your app.
13 13
 	 * @param string $redirectURI   The URL that you want the visitor redirected to after granting access to your app. For security reasons, this URL must use https.
14 14
 	 * @param array  $scopesArray   A set of scopes that your app will need access to.
15
-	 * @return \SevenShores\Hubspot\Http\Response
15
+	 * @return string
16 16
 	 */
17 17
 	function getAuthUrl($clientId, $redirectURI, $scopesArray=array())
18 18
 	{
Please login to merge, or discard this patch.
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -4,112 +4,112 @@
 block discarded – undo
4 4
 
5 5
 class OAuth2 extends Resource
6 6
 {
7
-	protected $endpoint = 'https://api.hubapi.com/oauth/v1';
7
+    protected $endpoint = 'https://api.hubapi.com/oauth/v1';
8 8
 
9
-	/**
10
-	 * Initiate an Integration with OAuth 2.0
11
-	 *
12
-	 * @param string $clientId      The Client ID of your app.
13
-	 * @param string $redirectURI   The URL that you want the visitor redirected to after granting access to your app. For security reasons, this URL must use https.
14
-	 * @param array  $scopesArray   A set of scopes that your app will need access to.
15
-	 * @return \SevenShores\Hubspot\Http\Response
16
-	 */
17
-	function getAuthUrl($clientId, $redirectURI, $scopesArray=array())
18
-	{
19
-		$scopeString = '';
20
-		if(count($scopesArray)>0)
21
-		{
22
-			$scopeString = '';
23
-			foreach($scopesArray as $_index => $scopeStr)
24
-			{
25
-				if($_index>0)
26
-					$scopeString .= "%20";
9
+    /**
10
+     * Initiate an Integration with OAuth 2.0
11
+     *
12
+     * @param string $clientId      The Client ID of your app.
13
+     * @param string $redirectURI   The URL that you want the visitor redirected to after granting access to your app. For security reasons, this URL must use https.
14
+     * @param array  $scopesArray   A set of scopes that your app will need access to.
15
+     * @return \SevenShores\Hubspot\Http\Response
16
+     */
17
+    function getAuthUrl($clientId, $redirectURI, $scopesArray=array())
18
+    {
19
+        $scopeString = '';
20
+        if(count($scopesArray)>0)
21
+        {
22
+            $scopeString = '';
23
+            foreach($scopesArray as $_index => $scopeStr)
24
+            {
25
+                if($_index>0)
26
+                    $scopeString .= "%20";
27 27
 
28
-				$scopeString .= $scopeStr;
29
-			}
30
-		}
28
+                $scopeString .= $scopeStr;
29
+            }
30
+        }
31 31
 
32
-		return "https://app.hubspot.com/oauth/authorize?client_id={$clientId}&scope={$scopeString}&redirect_uri=".urlencode($redirectURI);
33
-	}
32
+        return "https://app.hubspot.com/oauth/authorize?client_id={$clientId}&scope={$scopeString}&redirect_uri=".urlencode($redirectURI);
33
+    }
34 34
 
35
-	/**
36
-	 * Get OAuth 2.0 Access Token and Refresh Tokens by using a one-time code
37
-	 *
38
-	 * @param string $clientId      The Client ID of your app.
39
-	 * @param string $clientSecret  The Client Secret of your app.
40
-	 * @param string $redirectURI   The redirect URI that was used when the user authorized your app. This must exactly match the redirect_uri used when initiating the OAuth 2.0 connection.
41
-	 * @param string $tokenCode     The code parameter returned to your redirect URI when the user authorized your app. Or a refresh token.
42
-	 * @return \SevenShores\Hubspot\Http\Response
43
-	 */
44
-	function getTokensByCode($clientId, $clientSecret, $redirectURI, $tokenCode)
45
-	{
46
-		$options['form_params'] = [
47
-			'grant_type' => 'authorization_code',
48
-			'client_id' => $clientId,
49
-			'client_secret' => $clientSecret,
50
-			'redirect_uri' => $redirectURI,
51
-			'code' => $tokenCode
52
-		];
35
+    /**
36
+     * Get OAuth 2.0 Access Token and Refresh Tokens by using a one-time code
37
+     *
38
+     * @param string $clientId      The Client ID of your app.
39
+     * @param string $clientSecret  The Client Secret of your app.
40
+     * @param string $redirectURI   The redirect URI that was used when the user authorized your app. This must exactly match the redirect_uri used when initiating the OAuth 2.0 connection.
41
+     * @param string $tokenCode     The code parameter returned to your redirect URI when the user authorized your app. Or a refresh token.
42
+     * @return \SevenShores\Hubspot\Http\Response
43
+     */
44
+    function getTokensByCode($clientId, $clientSecret, $redirectURI, $tokenCode)
45
+    {
46
+        $options['form_params'] = [
47
+            'grant_type' => 'authorization_code',
48
+            'client_id' => $clientId,
49
+            'client_secret' => $clientSecret,
50
+            'redirect_uri' => $redirectURI,
51
+            'code' => $tokenCode
52
+        ];
53 53
 
54
-		$options['headers']['content-type'] = 'application/x-www-form-urlencoded';
54
+        $options['headers']['content-type'] = 'application/x-www-form-urlencoded';
55 55
 
56
-		return $this->client->request('post', $this->endpoint.'/token', $options);
57
-	}
56
+        return $this->client->request('post', $this->endpoint.'/token', $options);
57
+    }
58 58
 
59
-	/**
60
-	 * Get OAuth 2.0 Access Token and Refresh Tokens by using a refresh token
61
-	 * Note: Contrary to HubSpot documentation, $redirectURI is NOT required.
62
-	 *
63
-	 * @param string $clientId      The Client ID of your app.
64
-	 * @param string $clientSecret  The Client Secret of your app.
65
-	 * @param string $refreshToken  The refresh token.
66
-	 * @return \SevenShores\Hubspot\Http\Response
67
-	 */
68
-	function getTokensByRefresh($clientId, $clientSecret, $refreshToken)
69
-	{
70
-		$options['form_params'] = [
71
-			'grant_type' => 'refresh_token',
72
-			'client_id' => $clientId,
73
-			'client_secret' => $clientSecret,
74
-			'refresh_token' => $refreshToken
75
-		];
59
+    /**
60
+     * Get OAuth 2.0 Access Token and Refresh Tokens by using a refresh token
61
+     * Note: Contrary to HubSpot documentation, $redirectURI is NOT required.
62
+     *
63
+     * @param string $clientId      The Client ID of your app.
64
+     * @param string $clientSecret  The Client Secret of your app.
65
+     * @param string $refreshToken  The refresh token.
66
+     * @return \SevenShores\Hubspot\Http\Response
67
+     */
68
+    function getTokensByRefresh($clientId, $clientSecret, $refreshToken)
69
+    {
70
+        $options['form_params'] = [
71
+            'grant_type' => 'refresh_token',
72
+            'client_id' => $clientId,
73
+            'client_secret' => $clientSecret,
74
+            'refresh_token' => $refreshToken
75
+        ];
76 76
 
77
-		$options['headers']['content-type'] = 'application/x-www-form-urlencoded';
77
+        $options['headers']['content-type'] = 'application/x-www-form-urlencoded';
78 78
 
79
-		return $this->client->request('post', $this->endpoint.'/token', $options);
80
-	}
79
+        return $this->client->request('post', $this->endpoint.'/token', $options);
80
+    }
81 81
 
82
-	/**
83
-	 * Get Information for OAuth 2.0 Access Token
84
-	 *
85
-	 * @param  int $token The access token that you want to get the information for.
86
-	 * @return \SevenShores\Hubspot\Http\Response
87
-	 */
88
-	function getAccessTokenInfo($token)
89
-	{
90
-		return $this->client->request('get', $this->endpoint."/access-tokens/{$token}");
91
-	}
82
+    /**
83
+     * Get Information for OAuth 2.0 Access Token
84
+     *
85
+     * @param  int $token The access token that you want to get the information for.
86
+     * @return \SevenShores\Hubspot\Http\Response
87
+     */
88
+    function getAccessTokenInfo($token)
89
+    {
90
+        return $this->client->request('get', $this->endpoint."/access-tokens/{$token}");
91
+    }
92 92
 
93
-	/**
94
-	 * Get Information for OAuth 2.0 Refresh Token
95
-	 *
96
-	 * @param  int $token The refresh token that you want to get the information for.
97
-	 * @return \SevenShores\Hubspot\Http\Response
98
-	 */
99
-	function getRefreshTokenInfo($token)
100
-	{
101
-		return $this->client->request('get', $this->endpoint."/refresh-tokens/{$token}");
102
-	}
93
+    /**
94
+     * Get Information for OAuth 2.0 Refresh Token
95
+     *
96
+     * @param  int $token The refresh token that you want to get the information for.
97
+     * @return \SevenShores\Hubspot\Http\Response
98
+     */
99
+    function getRefreshTokenInfo($token)
100
+    {
101
+        return $this->client->request('get', $this->endpoint."/refresh-tokens/{$token}");
102
+    }
103 103
 
104
-	/**
105
-	 * Delete OAuth 2.0 Refresh Token
106
-	 *
107
-	 * @param  int $token The refresh token that you want to delete.
108
-	 * @return \SevenShores\Hubspot\Http\Response
109
-	 */
110
-	function deleteRefreshToken($token)
111
-	{
112
-		return $this->client->request('delete', $this->endpoint."/refresh-tokens/{$token}");
113
-	}
104
+    /**
105
+     * Delete OAuth 2.0 Refresh Token
106
+     *
107
+     * @param  int $token The refresh token that you want to delete.
108
+     * @return \SevenShores\Hubspot\Http\Response
109
+     */
110
+    function deleteRefreshToken($token)
111
+    {
112
+        return $this->client->request('delete', $this->endpoint."/refresh-tokens/{$token}");
113
+    }
114 114
 
115 115
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@
 block discarded – undo
14 14
 	 * @param array  $scopesArray   A set of scopes that your app will need access to.
15 15
 	 * @return \SevenShores\Hubspot\Http\Response
16 16
 	 */
17
-	function getAuthUrl($clientId, $redirectURI, $scopesArray=array())
17
+	function getAuthUrl($clientId, $redirectURI, $scopesArray = array())
18 18
 	{
19 19
 		$scopeString = '';
20
-		if(count($scopesArray)>0)
20
+		if (count($scopesArray) > 0)
21 21
 		{
22 22
 			$scopeString = '';
23
-			foreach($scopesArray as $_index => $scopeStr)
23
+			foreach ($scopesArray as $_index => $scopeStr)
24 24
 			{
25
-				if($_index>0)
25
+				if ($_index > 0)
26 26
 					$scopeString .= "%20";
27 27
 
28 28
 				$scopeString .= $scopeStr;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@
 block discarded – undo
22 22
 			$scopeString = '';
23 23
 			foreach($scopesArray as $_index => $scopeStr)
24 24
 			{
25
-				if($_index>0)
26
-					$scopeString .= "%20";
25
+				if($_index>0) {
26
+									$scopeString .= "%20";
27
+				}
27 28
 
28 29
 				$scopeString .= $scopeStr;
29 30
 			}
Please login to merge, or discard this patch.
src/Resources/HubDB.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
     public function createTable($name, array $columns, $published = true, $useForPages = false) {
74 74
         $endpoint = 'https://api.hubapi.com/hubdb/api/v1/tables';
75 75
         $options['json'] = ['name' => $name, 'columns' => $columns];
76
-        if($published) {
76
+        if ($published) {
77 77
             $options['json']['publishedAt'] = round(microtime(true) * 1000);
78 78
         }
79 79
         $options['json']['useForPages'] = $useForPages;
Please login to merge, or discard this patch.
src/Resources/ContactLists.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -172,8 +172,8 @@
 block discarded – undo
172 172
         $endpoint = "https://api.hubapi.com/contacts/v1/lists/{$list_id}/add";
173 173
 
174 174
         $options['json'] = [
175
-          'vids' => $contact_ids,
176
-          'emails' => $emails,
175
+            'vids' => $contact_ids,
176
+            'emails' => $emails,
177 177
         ];
178 178
 
179 179
         return $this->client->request('post', $endpoint, $options);
Please login to merge, or discard this patch.