@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | class MongoClient |
24 | 24 | { |
25 | 25 | const VERSION = '1.6.12'; |
26 | - const DEFAULT_HOST = "localhost" ; |
|
27 | - const DEFAULT_PORT = 27017 ; |
|
28 | - const RP_PRIMARY = "primary" ; |
|
29 | - const RP_PRIMARY_PREFERRED = "primaryPreferred" ; |
|
30 | - const RP_SECONDARY = "secondary" ; |
|
31 | - const RP_SECONDARY_PREFERRED = "secondaryPreferred" ; |
|
32 | - const RP_NEAREST = "nearest" ; |
|
26 | + const DEFAULT_HOST = "localhost"; |
|
27 | + const DEFAULT_PORT = 27017; |
|
28 | + const RP_PRIMARY = "primary"; |
|
29 | + const RP_PRIMARY_PREFERRED = "primaryPreferred"; |
|
30 | + const RP_SECONDARY = "secondary"; |
|
31 | + const RP_SECONDARY_PREFERRED = "secondaryPreferred"; |
|
32 | + const RP_NEAREST = "nearest"; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @var bool |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * {@link http://www.php.net/manual/en/class.mongoint64.php MongoInt64} class. The latter is necessary on 32 |
199 | 199 | * bit platforms (and Windows). |
200 | 200 | */ |
201 | - public function killCursor($server_hash , $id) |
|
201 | + public function killCursor($server_hash, $id) |
|
202 | 202 | { |
203 | 203 | |
204 | 204 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * http://php.net/manual/en/mongoresultexception.getdocument.php |
26 | 26 | * @return array <p>The full result document as an array, including partial data if available and additional keys.</p> |
27 | 27 | */ |
28 | - public function getDocument () {} |
|
28 | + public function getDocument() {} |
|
29 | 29 | |
30 | 30 | public $document; |
31 | 31 |
@@ -101,7 +101,7 @@ |
||
101 | 101 | * @param bool $ok |
102 | 102 | * @return bool returns the former value of slaveOkay for this instance. |
103 | 103 | */ |
104 | - public function setSlaveOkay ($ok) |
|
104 | + public function setSlaveOkay($ok) |
|
105 | 105 | { |
106 | 106 | $this->notImplemented(); |
107 | 107 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | */ |
78 | 78 | public static function get($db, $ref) |
79 | 79 | { |
80 | - if (! static::isRef($ref)) { |
|
80 | + if ( ! static::isRef($ref)) { |
|
81 | 81 | return null; |
82 | 82 | } |
83 | 83 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
46 | - if (! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) { |
|
46 | + if ( ! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) { |
|
47 | 47 | throw new MongoException('invalid regex', 9); |
48 | 48 | } |
49 | 49 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | $collections = $this->db->listCollections($options); |
134 | 134 | |
135 | - $getCollectionInfo = function (CollectionInfo $collectionInfo) { |
|
135 | + $getCollectionInfo = function(CollectionInfo $collectionInfo) { |
|
136 | 136 | return [ |
137 | 137 | 'name' => $collectionInfo->getName(), |
138 | 138 | 'options' => $collectionInfo->getOptions(), |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | $collections = $this->db->listCollections($options); |
160 | 160 | |
161 | - $getCollectionName = function (CollectionInfo $collectionInfo) { |
|
161 | + $getCollectionName = function(CollectionInfo $collectionInfo) { |
|
162 | 162 | return $collectionInfo->getName(); |
163 | 163 | }; |
164 | 164 | |
@@ -307,13 +307,13 @@ discard block |
||
307 | 307 | if ($document_or_id instanceof \MongoId) { |
308 | 308 | $id = $document_or_id; |
309 | 309 | } elseif (is_object($document_or_id)) { |
310 | - if (! isset($document_or_id->_id)) { |
|
310 | + if ( ! isset($document_or_id->_id)) { |
|
311 | 311 | return null; |
312 | 312 | } |
313 | 313 | |
314 | 314 | $id = $document_or_id->_id; |
315 | 315 | } elseif (is_array($document_or_id)) { |
316 | - if (! isset($document_or_id['_id'])) { |
|
316 | + if ( ! isset($document_or_id['_id'])) { |
|
317 | 317 | return null; |
318 | 318 | } |
319 | 319 |
@@ -119,7 +119,7 @@ |
||
119 | 119 | * <ul> |
120 | 120 | * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure. |
121 | 121 | */ |
122 | - public static function setCallback(callable $log_function ) |
|
122 | + public static function setCallback(callable $log_function) |
|
123 | 123 | { |
124 | 124 | self::$callback = $log_function; |
125 | 125 | return true; |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $filename = 'file'; |
76 | 76 | } |
77 | 77 | |
78 | - if (! $handle = fopen($filename, 'w')) { |
|
78 | + if ( ! $handle = fopen($filename, 'w')) { |
|
79 | 79 | trigger_error(E_ERROR, 'Can not open the destination file'); |
80 | 80 | return 0; |
81 | 81 | } |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | ]; |
242 | 242 | |
243 | 243 | $handle = fopen($filename, 'r'); |
244 | - if (! $handle) { |
|
244 | + if ( ! $handle) { |
|
245 | 245 | throw new MongoGridFSException('could not open file: ' . $filename); |
246 | 246 | } |
247 | - } elseif (! is_resource($filename)) { |
|
247 | + } elseif ( ! is_resource($filename)) { |
|
248 | 248 | throw new \Exception('first argument must be a string or stream resource'); |
249 | 249 | } else { |
250 | 250 | $handle = $filename; |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | |
267 | 267 | // Add length and MD5 if they were not present before |
268 | 268 | $update = []; |
269 | - if (! isset($record['length'])) { |
|
269 | + if ( ! isset($record['length'])) { |
|
270 | 270 | $update['length'] = $length; |
271 | 271 | } |
272 | - if (! isset($record['md5'])) { |
|
272 | + if ( ! isset($record['md5'])) { |
|
273 | 273 | try { |
274 | 274 | $update['md5'] = $this->getMd5ForFile($file['_id']); |
275 | 275 | } catch (MongoException $e) { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (count($update)) { |
281 | 281 | try { |
282 | 282 | $result = $this->update(['_id' => $file['_id']], ['$set' => $update]); |
283 | - if (! $this->isOKResult($result)) { |
|
283 | + if ( ! $this->isOKResult($result)) { |
|
284 | 284 | throw new MongoGridFSException('Error updating file record'); |
285 | 285 | } |
286 | 286 | } catch (MongoException $e) { |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function storeUpload($name, array $metadata = []) |
306 | 306 | { |
307 | - if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { |
|
307 | + if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) { |
|
308 | 308 | throw new MongoGridFSException("Could not find uploaded file $name"); |
309 | 309 | } |
310 | - if (! isset($_FILES[$name]['tmp_name'])) { |
|
310 | + if ( ! isset($_FILES[$name]['tmp_name'])) { |
|
311 | 311 | throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?"); |
312 | 312 | } |
313 | 313 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | $result = $this->chunks->insert($chunk); |
359 | 359 | |
360 | - if (! $this->isOKResult($result)) { |
|
360 | + if ( ! $this->isOKResult($result)) { |
|
361 | 361 | throw new \MongoException('error inserting chunk'); |
362 | 362 | } |
363 | 363 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $chunkSize = $record['chunkSize']; |
400 | 400 | |
401 | 401 | rewind($handle); |
402 | - while (! feof($handle)) { |
|
402 | + while ( ! feof($handle)) { |
|
403 | 403 | $data = stream_get_contents($handle, $chunkSize); |
404 | 404 | $this->insertChunk($fileId, $data, $i++); |
405 | 405 | $written += strlen($data); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | $result = $this->insert($record, $options); |
428 | 428 | |
429 | - if (! $this->isOKResult($result)) { |
|
429 | + if ( ! $this->isOKResult($result)) { |
|
430 | 430 | throw new \MongoException('error inserting file'); |
431 | 431 | } |
432 | 432 |