@@ -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 |
@@ -65,6 +65,6 @@ |
||
65 | 65 | public function key() |
66 | 66 | { |
67 | 67 | $file = $this->current(); |
68 | - return ($file !== null) ? (string)$file->file['_id'] : null; |
|
68 | + return ($file !== null) ? (string) $file->file['_id'] : null; |
|
69 | 69 | } |
70 | 70 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | use Alcaeus\MongoDbAdapter\TypeConverter; |
17 | 17 | |
18 | -if (! function_exists('bson_decode')) { |
|
18 | +if ( ! function_exists('bson_decode')) { |
|
19 | 19 | /** |
20 | 20 | * Deserializes a BSON object into a PHP array |
21 | 21 | * |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -if (! function_exists('bson_encode')) { |
|
31 | +if ( ! function_exists('bson_encode')) { |
|
32 | 32 | /** |
33 | 33 | * Serializes a PHP variable into a BSON string |
34 | 34 | * |
@@ -48,7 +48,7 @@ |
||
48 | 48 | { |
49 | 49 | if ($value instanceof ObjectID || $value instanceof MongoId) { |
50 | 50 | return true; |
51 | - } elseif (! is_string($value)) { |
|
51 | + } elseif ( ! is_string($value)) { |
|
52 | 52 | return false; |
53 | 53 | } |
54 | 54 |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function hasNext() |
223 | 223 | { |
224 | - if (! $this->startedIterating) { |
|
224 | + if ( ! $this->startedIterating) { |
|
225 | 225 | $this->ensureIterator(); |
226 | 226 | $this->startedIterating = true; |
227 | 227 | $this->storeIteratorState(); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | protected function convertCursorType() |
407 | 407 | { |
408 | - if (! $this->tailable) { |
|
408 | + if ( ! $this->tailable) { |
|
409 | 409 | return null; |
410 | 410 | } |
411 | 411 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | protected function wrapTraversable(\Traversable $traversable) |
447 | 447 | { |
448 | 448 | foreach ($traversable as $key => $value) { |
449 | - if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || !is_object($value->_id))) { |
|
449 | + if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || ! is_object($value->_id))) { |
|
450 | 450 | $key = (string) $value->_id; |
451 | 451 | } |
452 | 452 | yield $key => $value; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function add($item) |
84 | 84 | { |
85 | 85 | if (is_object($item)) { |
86 | - $item = (array)$item; |
|
86 | + $item = (array) $item; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $this->validate($item); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | final public function execute(array $writeOptions = []) |
103 | 103 | { |
104 | 104 | $writeOptions += $this->writeOptions; |
105 | - if (! count($this->items)) { |
|
105 | + if ( ! count($this->items)) { |
|
106 | 106 | return ['ok' => true]; |
107 | 107 | } |
108 | 108 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | break; |
168 | 168 | } |
169 | 169 | |
170 | - if (! $ok) { |
|
170 | + if ( ! $ok) { |
|
171 | 171 | // Exception code is hardcoded to the value in ext-mongo, see |
172 | 172 | // https://github.com/mongodb/mongo-php-driver-legacy/blob/ab4bc0d90e93b3f247f6bcb386d0abc8d2fa7d74/batch/write.c#L428 |
173 | 173 | throw new \MongoWriteConcernException('Failed write', 911, null, $resultDocument); |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | { |
181 | 181 | switch ($this->batchType) { |
182 | 182 | case self::COMMAND_UPDATE: |
183 | - if (! isset($item['q'])) { |
|
183 | + if ( ! isset($item['q'])) { |
|
184 | 184 | throw new Exception("Expected \$item to contain 'q' key"); |
185 | 185 | } |
186 | - if (! isset($item['u'])) { |
|
186 | + if ( ! isset($item['u'])) { |
|
187 | 187 | throw new Exception("Expected \$item to contain 'u' key"); |
188 | 188 | } |
189 | 189 | break; |
190 | 190 | |
191 | 191 | case self::COMMAND_DELETE: |
192 | - if (! isset($item['q'])) { |
|
192 | + if ( ! isset($item['q'])) { |
|
193 | 193 | throw new Exception("Expected \$item to contain 'q' key"); |
194 | 194 | } |
195 | - if (! isset($item['limit'])) { |
|
195 | + if ( ! isset($item['limit'])) { |
|
196 | 196 | throw new Exception("Expected \$item to contain 'limit' key"); |
197 | 197 | } |
198 | 198 | break; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function next() |
162 | 162 | { |
163 | - if (! $this->startedIterating) { |
|
163 | + if ( ! $this->startedIterating) { |
|
164 | 164 | $this->ensureIterator(); |
165 | 165 | $this->startedIterating = true; |
166 | 166 | } else { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | protected function storeIteratorState() |
404 | 404 | { |
405 | - if (! $this->startedIterating) { |
|
405 | + if ( ! $this->startedIterating) { |
|
406 | 406 | $this->current = null; |
407 | 407 | $this->key = null; |
408 | 408 | $this->valid = false; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $wstring = (int) $wstring; |
30 | 30 | } |
31 | 31 | |
32 | - if (! is_string($wstring) && ! is_int($wstring)) { |
|
32 | + if ( ! is_string($wstring) && ! is_int($wstring)) { |
|
33 | 33 | trigger_error("w for WriteConcern must be a string or integer", E_USER_WARNING); |
34 | 34 | return false; |
35 | 35 | } |