@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | try { |
200 | 200 | stream_wrapper_register($protocol, $class); |
201 | 201 | if (self::isDirectoryHandle($source)) { |
202 | - $wrapped = opendir($protocol . '://', $context); |
|
202 | + $wrapped = opendir($protocol.'://', $context); |
|
203 | 203 | } else { |
204 | - $wrapped = fopen($protocol . '://', $mode, false, $context); |
|
204 | + $wrapped = fopen($protocol.'://', $mode, false, $context); |
|
205 | 205 | } |
206 | 206 | } catch (\BadMethodCallException $e) { |
207 | 207 | stream_wrapper_unregister($protocol); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | if (array_key_exists($property, $context)) { |
226 | 226 | $this->{$property} = $context[$property]; |
227 | 227 | } else { |
228 | - throw new \BadMethodCallException('Invalid context, "' . $property . '" options not set'); |
|
228 | + throw new \BadMethodCallException('Invalid context, "'.$property.'" options not set'); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | return $context; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | // for seekable streams the pointer is moved back to the beginning of the encrypted block |
354 | 354 | // flush will start writing there when the position moves to another block |
355 | - $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) * |
|
355 | + $positionInFile = (int) floor($this->position / $this->unencryptedBlockSize) * |
|
356 | 356 | $this->util->getBlockSize() + $this->headerSize; |
357 | 357 | $resultFseek = $this->parentStreamSeek($positionInFile); |
358 | 358 | |
@@ -370,14 +370,14 @@ discard block |
||
370 | 370 | // update position and liberate $data |
371 | 371 | if ($remainingLength < ($this->unencryptedBlockSize - $blockPosition)) { |
372 | 372 | $this->cache = substr($this->cache, 0, $blockPosition) |
373 | - . $data . substr($this->cache, $blockPosition + $remainingLength); |
|
373 | + . $data.substr($this->cache, $blockPosition + $remainingLength); |
|
374 | 374 | $this->position += $remainingLength; |
375 | 375 | $length += $remainingLength; |
376 | 376 | $data = ''; |
377 | 377 | // if $data doesn't fit the current block, the fill the current block and reiterate |
378 | 378 | // after the block is filled, it is flushed and $data is updatedxxx |
379 | 379 | } else { |
380 | - $this->cache = substr($this->cache, 0, $blockPosition) . |
|
380 | + $this->cache = substr($this->cache, 0, $blockPosition). |
|
381 | 381 | substr($data, 0, $this->unencryptedBlockSize - $blockPosition); |
382 | 382 | $this->flush(); |
383 | 383 | $this->position += ($this->unencryptedBlockSize - $blockPosition); |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | |
436 | 436 | public function stream_close() { |
437 | 437 | $this->flush('end'); |
438 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
439 | - $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); |
|
438 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
439 | + $remainingData = $this->encryptionModule->end($this->fullPath, $position.'end'); |
|
440 | 440 | if ($this->readOnly === false) { |
441 | - if(!empty($remainingData)) { |
|
441 | + if (!empty($remainingData)) { |
|
442 | 442 | parent::stream_write($remainingData); |
443 | 443 | } |
444 | 444 | $this->encryptionStorage->updateUnencryptedSize($this->fullPath, $this->unencryptedSize); |
@@ -468,16 +468,16 @@ discard block |
||
468 | 468 | // automatically attempted when the file is written to disk - |
469 | 469 | // we are handling that separately here and we don't want to |
470 | 470 | // get into an infinite loop |
471 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
472 | - $encrypted = $this->encryptionModule->encrypt($this->cache, $position . $positionPrefix); |
|
471 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
472 | + $encrypted = $this->encryptionModule->encrypt($this->cache, $position.$positionPrefix); |
|
473 | 473 | $bytesWritten = parent::stream_write($encrypted); |
474 | 474 | $this->writeFlag = false; |
475 | 475 | // Check whether the write concerns the last block |
476 | 476 | // If so then update the encrypted filesize |
477 | 477 | // Note that the unencrypted pointer and filesize are NOT yet updated when flush() is called |
478 | 478 | // We recalculate the encrypted filesize as we do not know the context of calling flush() |
479 | - $completeBlocksInFile=(int)floor($this->unencryptedSize/$this->unencryptedBlockSize); |
|
480 | - if ($completeBlocksInFile === (int)floor($this->position/$this->unencryptedBlockSize)) { |
|
479 | + $completeBlocksInFile = (int) floor($this->unencryptedSize / $this->unencryptedBlockSize); |
|
480 | + if ($completeBlocksInFile === (int) floor($this->position / $this->unencryptedBlockSize)) { |
|
481 | 481 | $this->size = $this->util->getBlockSize() * $completeBlocksInFile; |
482 | 482 | $this->size += $bytesWritten; |
483 | 483 | $this->size += $this->headerSize; |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | if ($this->cache === '' && !($this->position === $this->unencryptedSize && ($this->position % $this->unencryptedBlockSize) === 0)) { |
497 | 497 | // Get the data from the file handle |
498 | 498 | $data = $this->stream_read_block($this->util->getBlockSize()); |
499 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
500 | - $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); |
|
501 | - if($numberOfChunks === $position) { |
|
499 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
500 | + $numberOfChunks = (int) ($this->unencryptedSize / $this->unencryptedBlockSize); |
|
501 | + if ($numberOfChunks === $position) { |
|
502 | 502 | $position .= 'end'; |
503 | 503 | } |
504 | 504 | $this->cache = $this->encryptionModule->decrypt($data, $position); |