Completed
Pull Request — master (#23)
by
unknown
02:41
created
src/GuzzleIzettleClient.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -65,26 +65,26 @@
 block discarded – undo
65 65
     }
66 66
 
67 67
     
68
-	public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code ): AccessToken
69
-	{
70
-		$options = [
71
-		   'form_params' => [
72
-			  'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT,
73
-			  'client_id' => $this->clientId,
74
-			  'client_secret' => $this->clientSecret,
75
-			  'redirect_uri' => $redirectUrl,
76
-			  'code' => $code
77
-		   ],
78
-		];
79
-
80
-		try {
81
-			$this->setAccessToken($this->requestAccessToken(self::API_ACCESS_TOKEN_REQUEST_URL, $options));
82
-		} catch (ClientException $exception) {
83
-			GuzzleClientExceptionHandler::handleClientException($exception);
84
-		}
85
-
86
-		return $this->accessToken;
87
-	}
68
+    public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code ): AccessToken
69
+    {
70
+        $options = [
71
+            'form_params' => [
72
+                'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT,
73
+                'client_id' => $this->clientId,
74
+                'client_secret' => $this->clientSecret,
75
+                'redirect_uri' => $redirectUrl,
76
+                'code' => $code
77
+            ],
78
+        ];
79
+
80
+        try {
81
+            $this->setAccessToken($this->requestAccessToken(self::API_ACCESS_TOKEN_REQUEST_URL, $options));
82
+        } catch (ClientException $exception) {
83
+            GuzzleClientExceptionHandler::handleClientException($exception);
84
+        }
85
+
86
+        return $this->accessToken;
87
+    }
88 88
     
89 89
     public function getAccessTokenFromUserLogin(string $username, string $password): AccessToken
90 90
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $url = self::API_AUTHORIZE_USER_LOGIN_URL;
58 58
         $url .= '?response_type=code';
59
-        $url .= '&redirect_uri=' . $redirectUrl;
60
-        $url .= '&client_id=' . $this->clientId;
61
-        $url .= '&scope=' . $apiScope->getUrlParameters();
59
+        $url .= '&redirect_uri='.$redirectUrl;
60
+        $url .= '&client_id='.$this->clientId;
61
+        $url .= '&scope='.$apiScope->getUrlParameters();
62 62
         $url .= '&state=oauth2';
63 63
 
64 64
         return $url;
65 65
     }
66 66
 
67 67
     
68
-	public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code ): AccessToken
68
+	public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code): AccessToken
69 69
 	{
70 70
 		$options = [
71 71
 		   'form_params' => [
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         return $this->accessToken;
108 108
     }
109 109
 
110
-    public function refreshAccessToken(?AccessToken $accessToken =  null): AccessToken
110
+    public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken
111 111
     {
112 112
         $accessToken = $accessToken ?? $this->accessToken;
113 113
         $options = [
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function get(string $url, ?array $queryParameters = null): ResponseInterface
128 128
     {
129
-        $options =  array_merge(['headers' => $this->getAuthorizationHeader()], ['query' => $queryParameters]);
129
+        $options = array_merge(['headers' => $this->getAuthorizationHeader()], ['query' => $queryParameters]);
130 130
 
131 131
         try {
132 132
             $response = $this->guzzleClient->get($url, $options);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             ]
148 148
         );
149 149
 
150
-        $options =  array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]);
150
+        $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]);
151 151
 
152 152
         return $this->guzzleClient->post($url, $options);
153 153
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             ]
163 163
         );
164 164
 
165
-        $options =  array_merge(['headers' => $headers], ['body' => $jsonData]);
165
+        $options = array_merge(['headers' => $headers], ['body' => $jsonData]);
166 166
 
167 167
         $this->guzzleClient->put($url, $options);
168 168
     }
Please login to merge, or discard this patch.
src/IzettleClientInterface.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
     const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL . '/token';
16 16
     const API_ACCESS_TOKEN_PASSWORD_GRANT = 'password';
17
-	const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code';
17
+    const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code';
18 18
     const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL . '/token';
19 19
     const API_ACCESS_TOKEN_REFRESH_TOKEN_GRANT = 'refresh_token';
20 20
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 interface IzettleClientInterface
11 11
 {
12 12
     const API_BASE_URL = 'https://oauth.izettle.net';
13
-    const API_AUTHORIZE_USER_LOGIN_URL = self::API_BASE_URL . '/authorize';
13
+    const API_AUTHORIZE_USER_LOGIN_URL = self::API_BASE_URL.'/authorize';
14 14
 
15
-    const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL . '/token';
15
+    const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL.'/token';
16 16
     const API_ACCESS_TOKEN_PASSWORD_GRANT = 'password';
17 17
 	const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code';
18
-    const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL . '/token';
18
+    const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL.'/token';
19 19
     const API_ACCESS_TOKEN_REFRESH_TOKEN_GRANT = 'refresh_token';
20 20
 
21 21
     public function setAccessToken(AccessToken $accessToken): void;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getAccessTokenFromUserLogin(string $username, string $password): AccessToken;
26 26
 
27
-    public function refreshAccessToken(?AccessToken $accessToken =  null): AccessToken;
27
+    public function refreshAccessToken(?AccessToken $accessToken = null): AccessToken;
28 28
 
29 29
     public function get(string $url, ?array $queryParameters = null): ResponseInterface;
30 30
 
Please login to merge, or discard this patch.