@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function findOne($query = [], array $fields = [], array $options = []) |
| 133 | 133 | { |
| 134 | - if (! is_array($query)) { |
|
| 134 | + if ( ! is_array($query)) { |
|
| 135 | 135 | $query = ['filename' => (string) $query]; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | try { |
| 208 | 208 | $file = $this->insertFile($record, $options); |
| 209 | 209 | } catch (MongoException $e) { |
| 210 | - throw new MongoGridFSException('Could not store file: '. $e->getMessage(), $e->getCode(), $e); |
|
| 210 | + throw new MongoGridFSException('Could not store file: ' . $e->getMessage(), $e->getCode(), $e); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | try { |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | ]; |
| 245 | 245 | |
| 246 | 246 | $handle = fopen($filename, 'r'); |
| 247 | - if (! $handle) { |
|
| 247 | + if ( ! $handle) { |
|
| 248 | 248 | throw new MongoGridFSException('could not open file: ' . $filename); |
| 249 | 249 | } |
| 250 | - } elseif (! is_resource($filename)) { |
|
| 250 | + } elseif ( ! is_resource($filename)) { |
|
| 251 | 251 | throw new \Exception('first argument must be a string or stream resource'); |
| 252 | 252 | } else { |
| 253 | 253 | $handle = $filename; |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | // Add length and MD5 if they were not present before |
| 272 | 272 | $update = []; |
| 273 | - if (! isset($record['length'])) { |
|
| 273 | + if ( ! isset($record['length'])) { |
|
| 274 | 274 | $update['length'] = $length; |
| 275 | 275 | } |
| 276 | - if (! isset($record['md5'])) { |
|
| 276 | + if ( ! isset($record['md5'])) { |
|
| 277 | 277 | try { |
| 278 | 278 | $update['md5'] = $md5; |
| 279 | 279 | } catch (MongoException $e) { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | if (count($update)) { |
| 285 | 285 | try { |
| 286 | 286 | $result = $this->update(['_id' => $file['_id']], ['$set' => $update]); |
| 287 | - if (! $this->isOKResult($result)) { |
|
| 287 | + if ( ! $this->isOKResult($result)) { |
|
| 288 | 288 | throw new MongoGridFSException('Could not store file'); |
| 289 | 289 | } |
| 290 | 290 | } catch (MongoException $e) { |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public function storeUpload($name, array $metadata = []) |
| 309 | 309 | { |
| 310 | - if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { |
|
| 310 | + if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { |
|
| 311 | 311 | throw new MongoGridFSException("Could not find uploaded file $name"); |
| 312 | 312 | } |
| 313 | - if (! isset($_FILES[$name]['tmp_name'])) { |
|
| 313 | + if ( ! isset($_FILES[$name]['tmp_name'])) { |
|
| 314 | 314 | throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?"); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | $result = $this->chunks->insert($chunk); |
| 362 | 362 | |
| 363 | - if (! $this->isOKResult($result)) { |
|
| 363 | + if ( ! $this->isOKResult($result)) { |
|
| 364 | 364 | throw new \MongoException('error inserting chunk'); |
| 365 | 365 | } |
| 366 | 366 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $hash = hash_init('md5'); |
| 406 | 406 | |
| 407 | 407 | rewind($handle); |
| 408 | - while (! feof($handle)) { |
|
| 408 | + while ( ! feof($handle)) { |
|
| 409 | 409 | $data = stream_get_contents($handle, $chunkSize); |
| 410 | 410 | hash_update($hash, $data); |
| 411 | 411 | $this->insertChunk($fileId, $data, $i++); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | $result = $this->insert($record, $options); |
| 437 | 437 | |
| 438 | - if (! $this->isOKResult($result)) { |
|
| 438 | + if ( ! $this->isOKResult($result)) { |
|
| 439 | 439 | throw new \MongoException('error inserting file'); |
| 440 | 440 | } |
| 441 | 441 | |