@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function buildFromJson(string $jsonData): PurchaseHistory |
| 20 | 20 | { |
| 21 | - $data = json_decode($jsonData, true); |
|
| 21 | + $data = json_decode($jsonData, true); |
|
| 22 | 22 | |
| 23 | 23 | return new PurchaseHistory( |
| 24 | 24 | $data['firstPurchaseHash'], |
@@ -68,37 +68,37 @@ |
||
| 68 | 68 | { |
| 69 | 69 | $scope = []; |
| 70 | 70 | if ($this->finance !== null) { |
| 71 | - $scope[] = $this->finance->getValue() . ':' . self::FINANCE; |
|
| 71 | + $scope[] = $this->finance->getValue().':'.self::FINANCE; |
|
| 72 | 72 | if ($this->finance->getValue() == Rights::WRITE) { |
| 73 | - $scope[] = Rights::READ . ':' . self::FINANCE; |
|
| 73 | + $scope[] = Rights::READ.':'.self::FINANCE; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if ($this->purchase !== null) { |
| 78 | - $scope[] = $this->purchase->getValue() . ':' . self::PURCHASE; |
|
| 78 | + $scope[] = $this->purchase->getValue().':'.self::PURCHASE; |
|
| 79 | 79 | if ($this->purchase->getValue() == Rights::WRITE) { |
| 80 | - $scope[] = Rights::READ . ':' . self::PURCHASE; |
|
| 80 | + $scope[] = Rights::READ.':'.self::PURCHASE; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($this->product !== null) { |
| 85 | - $scope[] = $this->product->getValue() . ':' . self::PRODUCT; |
|
| 85 | + $scope[] = $this->product->getValue().':'.self::PRODUCT; |
|
| 86 | 86 | if ($this->product->getValue() == Rights::WRITE) { |
| 87 | - $scope[] = Rights::READ . ':' . self::PRODUCT; |
|
| 87 | + $scope[] = Rights::READ.':'.self::PRODUCT; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ($this->inventory !== null) { |
| 92 | - $scope[] = $this->inventory->getValue() . ':' . self::INVENTORY; |
|
| 92 | + $scope[] = $this->inventory->getValue().':'.self::INVENTORY; |
|
| 93 | 93 | if ($this->inventory->getValue() == Rights::WRITE) { |
| 94 | - $scope[] = Rights::READ . ':' . self::INVENTORY; |
|
| 94 | + $scope[] = Rights::READ.':'.self::INVENTORY; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if ($this->image !== null) { |
| 99 | - $scope[] = $this->image->getValue() . ':' . self::IMAGE; |
|
| 99 | + $scope[] = $this->image->getValue().':'.self::IMAGE; |
|
| 100 | 100 | if ($this->image->getValue() == Rights::WRITE) { |
| 101 | - $scope[] = Rights::READ . ':' . self::IMAGE; |
|
| 101 | + $scope[] = Rights::READ.':'.self::IMAGE; |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
@@ -10,12 +10,12 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -68,13 +68,13 @@ |
||
| 68 | 68 | public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code): AccessToken |
| 69 | 69 | { |
| 70 | 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 | - ], |
|
| 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 | 78 | ]; |
| 79 | 79 | |
| 80 | 80 | try { |
@@ -56,9 +56,9 @@ discard block |
||
| 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; |
@@ -107,7 +107,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | ] |
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | - $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]); |
|
| 153 | + $options = array_merge(['headers' => $headers], ['body' => $postable->getPostBodyData()]); |
|
| 154 | 154 | try { |
| 155 | 155 | return $this->guzzleClient->post($url, $options); |
| 156 | 156 | } catch (ClientException $exception) { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ] |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | - $options = array_merge(['headers' => $headers], ['body' => $jsonData]); |
|
| 174 | + $options = array_merge(['headers' => $headers], ['body' => $jsonData]); |
|
| 175 | 175 | |
| 176 | 176 | try { |
| 177 | 177 | $this->guzzleClient->put($url, $options); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ImageCollection $imageCollection, |
| 113 | 113 | VariantCollection $variants, |
| 114 | 114 | ?string $externalReference = null |
| 115 | - ): self { |
|
| 115 | + ) : self { |
|
| 116 | 116 | return new self( |
| 117 | 117 | Uuid::uuid1(), |
| 118 | 118 | $categories, |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | VariantCollection $variants, |
| 211 | 211 | ?string $externalReference = null, |
| 212 | 212 | ?string $etag = null, |
| 213 | - ?DateTime $updatedAt = null, |
|
| 213 | + ?DateTime $updatedAt = null, |
|
| 214 | 214 | ?UuidInterface $updatedBy = null, |
| 215 | 215 | ?DateTime $createdAt = null, |
| 216 | 216 | ?Vat $vatPercentage = null |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | Money $price, |
| 100 | 100 | ?Money $costPrice = null, |
| 101 | 101 | ?Vat $vat = null |
| 102 | - ): self { |
|
| 102 | + ) : self { |
|
| 103 | 103 | return new self( |
| 104 | 104 | Uuid::uuid1(), |
| 105 | 105 | $name, |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | ]; |
| 183 | 183 | |
| 184 | 184 | if ($this->costPrice) { |
| 185 | - $data['costPrice'] =[ |
|
| 185 | + $data['costPrice'] = [ |
|
| 186 | 186 | 'amount' => $this->costPrice->getAmount(), |
| 187 | 187 | 'currencyId' => (string) $this->costPrice->getCurrency() |
| 188 | 188 | ]; |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | return null; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - return new Vat((string)$data[$key]); |
|
| 85 | + return new Vat((string) $data[$key]); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | private function getImageFromKey(string $key, array $data): ?Image |