@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | protected function setWriteConcernFromParameters($wstring, $wtimeout = 0) |
57 | 57 | { |
58 | - if (! is_string($wstring) && ! is_int($wstring)) { |
|
58 | + if ( ! is_string($wstring) && ! is_int($wstring)) { |
|
59 | 59 | trigger_error("w for WriteConcern must be a string or integer", E_WARNING); |
60 | 60 | return false; |
61 | 61 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var MongoDB |
34 | 34 | */ |
35 | - public $db = NULL; |
|
35 | + public $db = null; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @var string |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | foreach (func_get_args() as $operator) { |
134 | 134 | $i++; |
135 | 135 | if (! is_array($operator)) { |
136 | - trigger_error("Argument $i is not an array", E_WARNING); |
|
136 | + trigger_error("argument $i is not an array", E_WARNING); |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @param bool $scan_data Only validate indices, not the base collection. |
235 | 235 | * @return array Returns the database's evaluation of this object. |
236 | 236 | */ |
237 | - public function validate($scan_data = FALSE) |
|
237 | + public function validate($scan_data = false) |
|
238 | 238 | { |
239 | 239 | $command = [ |
240 | 240 | 'validate' => $this->name, |
@@ -468,7 +468,7 @@ |
||
468 | 468 | * @link http://www.php.net/manual/en/mongocollection.createindex.php |
469 | 469 | * @param array $keys Field or fields to use as index. |
470 | 470 | * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...). |
471 | - * @return array Returns the database response. |
|
471 | + * @return string|false Returns the database response. |
|
472 | 472 | * |
473 | 473 | * @todo This method does not yet return the correct result |
474 | 474 | */ |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function aggregate(array $pipeline, array $op = []) |
127 | 127 | { |
128 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
128 | + if ( ! TypeConverter::isNumericArray($pipeline)) { |
|
129 | 129 | $pipeline = []; |
130 | 130 | $options = []; |
131 | 131 | |
132 | 132 | $i = 0; |
133 | 133 | foreach (func_get_args() as $operator) { |
134 | 134 | $i++; |
135 | - if (! is_array($operator)) { |
|
135 | + if ( ! is_array($operator)) { |
|
136 | 136 | trigger_error("Argument $i is not an array", E_WARNING); |
137 | 137 | return; |
138 | 138 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | ]; |
171 | 171 | |
172 | 172 | // Convert cursor option |
173 | - if (! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) { |
|
173 | + if ( ! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) { |
|
174 | 174 | // Cursor option needs to be an object convert bools and empty arrays since those won't be handled by TypeConverter |
175 | 175 | $options['cursor'] = new \stdClass; |
176 | 176 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $this->convertWriteConcernOptions($options) |
263 | 263 | ); |
264 | 264 | |
265 | - if (! $result->isAcknowledged()) { |
|
265 | + if ( ! $result->isAcknowledged()) { |
|
266 | 266 | return true; |
267 | 267 | } |
268 | 268 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $this->convertWriteConcernOptions($options) |
291 | 291 | ); |
292 | 292 | |
293 | - if (! $result->isAcknowledged()) { |
|
293 | + if ( ! $result->isAcknowledged()) { |
|
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @throws MongoCursorException |
315 | 315 | * @return boolean |
316 | 316 | */ |
317 | - public function update(array $criteria , array $newobj, array $options = []) |
|
317 | + public function update(array $criteria, array $newobj, array $options = []) |
|
318 | 318 | { |
319 | 319 | $multiple = isset($options['multiple']) ? $options['multiple'] : false; |
320 | 320 | $method = $multiple ? 'updateMany' : 'updateOne'; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $this->convertWriteConcernOptions($options) |
328 | 328 | ); |
329 | 329 | |
330 | - if (! $result->isAcknowledged()) { |
|
330 | + if ( ! $result->isAcknowledged()) { |
|
331 | 331 | return true; |
332 | 332 | } |
333 | 333 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function remove(array $criteria = [], array $options = []) |
356 | 356 | { |
357 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
357 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
358 | 358 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
359 | 359 | |
360 | 360 | /** @var \MongoDB\DeleteResult $result */ |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $this->convertWriteConcernOptions($options) |
364 | 364 | ); |
365 | 365 | |
366 | - if (! $result->isAcknowledged()) { |
|
366 | + if ( ! $result->isAcknowledged()) { |
|
367 | 367 | return true; |
368 | 368 | } |
369 | 369 | |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | if ($document_or_id instanceof \MongoId) { |
607 | 607 | $id = $document_or_id; |
608 | 608 | } elseif (is_object($document_or_id)) { |
609 | - if (! isset($document_or_id->_id)) { |
|
609 | + if ( ! isset($document_or_id->_id)) { |
|
610 | 610 | return null; |
611 | 611 | } |
612 | 612 | |
613 | 613 | $id = $document_or_id->_id; |
614 | 614 | } elseif (is_array($document_or_id)) { |
615 | - if (! isset($document_or_id['_id'])) { |
|
615 | + if ( ! isset($document_or_id['_id'])) { |
|
616 | 616 | return null; |
617 | 617 | } |
618 | 618 | |
@@ -655,14 +655,14 @@ discard block |
||
655 | 655 | $command = [ |
656 | 656 | 'group' => [ |
657 | 657 | 'ns' => $this->name, |
658 | - '$reduce' => (string)$reduce, |
|
658 | + '$reduce' => (string) $reduce, |
|
659 | 659 | 'initial' => $initial, |
660 | 660 | 'cond' => $condition, |
661 | 661 | ], |
662 | 662 | ]; |
663 | 663 | |
664 | 664 | if ($keys instanceof MongoCode) { |
665 | - $command['group']['$keyf'] = (string)$keys; |
|
665 | + $command['group']['$keyf'] = (string) $keys; |
|
666 | 666 | } else { |
667 | 667 | $command['group']['key'] = $keys; |
668 | 668 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | if (array_key_exists('finalize', $condition)) { |
673 | 673 | if ($condition['finalize'] instanceof MongoCode) { |
674 | - $condition['finalize'] = (string)$condition['finalize']; |
|
674 | + $condition['finalize'] = (string) $condition['finalize']; |
|
675 | 675 | } |
676 | 676 | $command['group']['finalize'] = $condition['finalize']; |
677 | 677 | } |
@@ -725,11 +725,11 @@ discard block |
||
725 | 725 | $options['w'] = ($options['safe']) ? 1 : 0; |
726 | 726 | } |
727 | 727 | |
728 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
728 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
729 | 729 | $options['wTimeoutMS'] = $options['wtimeout']; |
730 | 730 | } |
731 | 731 | |
732 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
732 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
733 | 733 | $collectionWriteConcern = $this->getWriteConcern(); |
734 | 734 | $writeConcern = $this->createWriteConcernFromParameters( |
735 | 735 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -13,6 +13,7 @@ |
||
13 | 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14 | 14 | */ |
15 | 15 | |
16 | -class MongoConnectionException extends MongoException { |
|
16 | +class MongoConnectionException extends MongoException |
|
17 | +{ |
|
17 | 18 | |
18 | 19 | } |
@@ -13,6 +13,7 @@ |
||
13 | 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14 | 14 | */ |
15 | 15 | |
16 | -class MongoCursorException extends MongoException { |
|
16 | +class MongoCursorException extends MongoException |
|
17 | +{ |
|
17 | 18 | |
18 | 19 | } |
@@ -13,6 +13,7 @@ |
||
13 | 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14 | 14 | */ |
15 | 15 | |
16 | -class MongoCursorTimeoutException extends MongoCursorException { |
|
16 | +class MongoCursorTimeoutException extends MongoCursorException |
|
17 | +{ |
|
17 | 18 | |
18 | 19 | } |
@@ -204,7 +204,7 @@ |
||
204 | 204 | * @param bool $backup_original_files [optional] <p>If original files should be backed up.</p> |
205 | 205 | * @return array <p>Returns db response.</p> |
206 | 206 | */ |
207 | - public function repair($preserve_cloned_files = FALSE, $backup_original_files = FALSE) |
|
207 | + public function repair($preserve_cloned_files = false, $backup_original_files = false) |
|
208 | 208 | { |
209 | 209 | return []; |
210 | 210 | } |
@@ -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 |
@@ -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 |
@@ -17,6 +17,7 @@ |
||
17 | 17 | * <p>(PECL mongo >= 1.5.0)</p> |
18 | 18 | * @link http://php.net/manual/en/class.mongoduplicatekeyexception.php |
19 | 19 | */ |
20 | -class MongoDuplicateKeyException extends MongoWriteConcernException { |
|
20 | +class MongoDuplicateKeyException extends MongoWriteConcernException |
|
21 | +{ |
|
21 | 22 | |
22 | 23 | } |
@@ -13,5 +13,6 @@ |
||
13 | 13 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14 | 14 | */ |
15 | 15 | |
16 | -class MongoException extends Exception { |
|
16 | +class MongoException extends Exception |
|
17 | +{ |
|
17 | 18 | } |