@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function ping() |
| 108 | 108 | { |
| 109 | - $endpoint = $this->endpoint.'Ping'; |
|
| 109 | + $endpoint = $this->endpoint . 'Ping'; |
|
| 110 | 110 | |
| 111 | 111 | $request = $this->client->request('GET', $endpoint); |
| 112 | 112 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $this->isFile($filePath); |
| 134 | 134 | |
| 135 | - $encryptedFilePath = $filePath.'.iron'; |
|
| 135 | + $encryptedFilePath = $filePath . '.iron'; |
|
| 136 | 136 | |
| 137 | 137 | $this->ping(); |
| 138 | 138 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function containerKeyData() |
| 164 | 164 | { |
| 165 | - $endpoint = $this->endpoint.'ContainerKeyData'; |
|
| 165 | + $endpoint = $this->endpoint . 'ContainerKeyData'; |
|
| 166 | 166 | |
| 167 | 167 | $request = $this->client->request('POST', $endpoint, [ |
| 168 | 168 | 'headers' => $this->httpHeaders, |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $response = json_decode($request->getBody()->getContents(), true); |
| 182 | 182 | |
| 183 | - if (! $response || |
|
| 184 | - ! is_array($response) || |
|
| 185 | - ! isset($response['SessionKeyBase64'], $response['SessionIVBase64'], $response['SymmetricKeyStrength']) |
|
| 183 | + if (!$response || |
|
| 184 | + !is_array($response) || |
|
| 185 | + !isset($response['SessionKeyBase64'], $response['SessionIVBase64'], $response['SymmetricKeyStrength']) |
|
| 186 | 186 | ) { |
| 187 | 187 | throw new IronBoxException('ContainerKeyData call returned invalid data'); |
| 188 | 188 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function createEntityContainerBlob(string $blobName) |
| 208 | 208 | { |
| 209 | - $endpoint = $this->endpoint.'CreateEntityContainerBlob'; |
|
| 209 | + $endpoint = $this->endpoint . 'CreateEntityContainerBlob'; |
|
| 210 | 210 | |
| 211 | 211 | $request = $this->client->request('POST', $endpoint, [ |
| 212 | 212 | 'headers' => $this->httpHeaders, |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | $response = json_decode($request->getBody()->getContents(), true); |
| 227 | 227 | |
| 228 | - if (! $response || ! is_string($response)) { |
|
| 228 | + if (!$response || !is_string($response)) { |
|
| 229 | 229 | throw new IronBoxException('CreateEntityContainerBlob call returned invalid data'); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function checkOutEntityContainerBlob(string $blobIdName) |
| 247 | 247 | { |
| 248 | - $endpoint = $this->endpoint.'CheckOutEntityContainerBlob'; |
|
| 248 | + $endpoint = $this->endpoint . 'CheckOutEntityContainerBlob'; |
|
| 249 | 249 | |
| 250 | 250 | $request = $this->client->request('POST', $endpoint, [ |
| 251 | 251 | 'headers' => $this->httpHeaders, |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | $response = json_decode($request->getBody()->getContents(), true); |
| 266 | 266 | |
| 267 | - if (! $response || ! is_array($response)) { |
|
| 267 | + if (!$response || !is_array($response)) { |
|
| 268 | 268 | throw new IronBoxException('CheckOutEntityContainerBlob call returned invalid data'); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -296,20 +296,20 @@ discard block |
||
| 296 | 296 | $blockSizeBytes = 4 * 1024 * 1024; |
| 297 | 297 | |
| 298 | 298 | // Open handle to encrypted file and send it in blocks |
| 299 | - $sasUriBlockPrefix = $checkOutData->sharedAccessSignatureUri.'&comp=block&blockid='; |
|
| 299 | + $sasUriBlockPrefix = $checkOutData->sharedAccessSignatureUri . '&comp=block&blockid='; |
|
| 300 | 300 | $blockIds = []; |
| 301 | 301 | |
| 302 | 302 | $i = 0; |
| 303 | 303 | $fh = fopen($encryptedFilePath, 'r'); |
| 304 | 304 | |
| 305 | - while (! feof($fh)) { |
|
| 305 | + while (!feof($fh)) { |
|
| 306 | 306 | $buf = fread($fh, $blockSizeBytes); |
| 307 | 307 | |
| 308 | 308 | // block IDs all have to be the same length, which was NOT documented by MSFT |
| 309 | - $blockId = 'block'.str_pad($i, 8, 0, STR_PAD_LEFT); |
|
| 309 | + $blockId = 'block' . str_pad($i, 8, 0, STR_PAD_LEFT); |
|
| 310 | 310 | |
| 311 | 311 | // Create a blob block |
| 312 | - $request = $this->client->request('PUT', $sasUriBlockPrefix.base64_encode($blockId), [ |
|
| 312 | + $request = $this->client->request('PUT', $sasUriBlockPrefix . base64_encode($blockId), [ |
|
| 313 | 313 | 'headers' => [ |
| 314 | 314 | 'content-type' => 'application/octet-stream', |
| 315 | 315 | 'x-ms-blob-type' => 'BlockBlob', |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $blockListBody .= sprintf('<Latest>%s</Latest>', $encodedBlockId); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - $request = $this->client->request('PUT', $checkOutData->sharedAccessSignatureUri.'&comp=blockList', [ |
|
| 344 | + $request = $this->client->request('PUT', $checkOutData->sharedAccessSignatureUri . '&comp=blockList', [ |
|
| 345 | 345 | 'headers' => [ |
| 346 | 346 | 'content-type' => 'text/xml', |
| 347 | 347 | 'x-ms-version' => '2012-02-12', |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $this->isFile($filePath); |
| 377 | 377 | $checkoutData->validate(); |
| 378 | 378 | |
| 379 | - $endpoint = $this->endpoint.'CheckInEntityContainerBlob'; |
|
| 379 | + $endpoint = $this->endpoint . 'CheckInEntityContainerBlob'; |
|
| 380 | 380 | |
| 381 | 381 | $request = $this->client->request('POST', $endpoint, [ |
| 382 | 382 | 'headers' => $this->httpHeaders, |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | protected function hash($iv, $value) |
| 207 | 207 | { |
| 208 | - return hash_hmac('sha256', $iv.$value, $this->key); |
|
| 208 | + return hash_hmac('sha256', $iv . $value, $this->key); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | // If the payload is not valid JSON or does not have the proper keys set we will |
| 225 | 225 | // assume it is invalid and bail out of the routine since we will not be able |
| 226 | 226 | // to decrypt the given value. We'll also check the MAC for this encryption. |
| 227 | - if (! $this->validPayload($payload)) { |
|
| 227 | + if (!$this->validPayload($payload)) { |
|
| 228 | 228 | throw new DecryptException('The payload is invalid.'); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if (! $this->validMac($payload)) { |
|
| 231 | + if (!$this->validMac($payload)) { |
|
| 232 | 232 | throw new DecryptException('The MAC is invalid.'); |
| 233 | 233 | } |
| 234 | 234 | |