Completed
Pull Request — master (#2)
by Svilen
01:35
created
src/CheckOutData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 
76 76
     public function __get($key)
77 77
     {
78
-        if (! isset($this->{$key})) {
78
+        if (!isset($this->{$key})) {
79 79
             throw new IronBoxException("Property `{$key}` doesn't exist");
80 80
         }
81 81
 
Please login to merge, or discard this patch.
src/ContainerKeyData.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function setCipher()
119 119
     {
120
-        if (! isset($this->supportedCiphers[$this->keyStrength])) {
120
+        if (!isset($this->supportedCiphers[$this->keyStrength])) {
121 121
             throw new IronBoxException('Unsupported cipher');
122 122
         }
123 123
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function __get($key)
128 128
     {
129
-        if (! isset($this->{$key})) {
129
+        if (!isset($this->{$key})) {
130 130
             throw new Exception("Property `{$key}` doesn't exist");
131 131
         }
132 132
 
Please login to merge, or discard this patch.
src/Encryption/FileEncrypter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
             $in = fopen($this->inputFile, 'rb');
52 52
             $out = fopen($this->outputFile, 'wb');
53 53
 
54
-            while (! feof($in)) {
54
+            while (!feof($in)) {
55 55
                 $line = fread($in, $readBlockSize);
56 56
 
57 57
                 if (strlen($line) < $readBlockSize) {
Please login to merge, or discard this patch.
src/IronBox.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/Encryption/Encrypter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.