@@ -163,7 +163,7 @@ public function bulkWrite(array $bulk, array $options = array())
163
163
foreach ($ bulk as $ n => $ op ) {
164
164
foreach ($ op as $ opname => $ args ) {
165
165
if (!isset ($ args [0 ])) {
166
- throw new \ InvalidArgumentException (sprintf ("Missing argument#1 for '%s' (operation#%d) " , $ opname , $ n ));
166
+ throw new InvalidArgumentException (sprintf ("Missing argument#1 for '%s' (operation#%d) " , $ opname , $ n ));
167
167
}
168
168
169
169
switch ($ opname ) {
@@ -173,7 +173,7 @@ public function bulkWrite(array $bulk, array $options = array())
173
173
174
174
case "updateMany " :
175
175
if (!isset ($ args [1 ])) {
176
- throw new \ InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
176
+ throw new InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
177
177
}
178
178
$ options = array_merge ($ this ->getWriteOptions (), isset ($ args [2 ]) ? $ args [2 ] : array (), array ("limit " => 0 ));
179
179
@@ -182,25 +182,25 @@ public function bulkWrite(array $bulk, array $options = array())
182
182
183
183
case "updateOne " :
184
184
if (!isset ($ args [1 ])) {
185
- throw new \ InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
185
+ throw new InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
186
186
}
187
187
$ options = array_merge ($ this ->getWriteOptions (), isset ($ args [2 ]) ? $ args [2 ] : array (), array ("limit " => 1 ));
188
188
$ firstKey = key ($ args [1 ]);
189
189
if (!isset ($ firstKey [0 ]) || $ firstKey [0 ] != '$ ' ) {
190
- throw new \ InvalidArgumentException ("First key in \$update must be a \$operator " );
190
+ throw new InvalidArgumentException ("First key in \$update must be a \$operator " );
191
191
}
192
192
193
193
$ bulk ->update ($ args [0 ], $ args [1 ], $ options );
194
194
break ;
195
195
196
196
case "replaceOne " :
197
197
if (!isset ($ args [1 ])) {
198
- throw new \ InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
198
+ throw new InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
199
199
}
200
200
$ options = array_merge ($ this ->getWriteOptions (), isset ($ args [2 ]) ? $ args [2 ] : array (), array ("limit " => 1 ));
201
201
$ firstKey = key ($ args [1 ]);
202
202
if (isset ($ firstKey [0 ]) && $ firstKey [0 ] == '$ ' ) {
203
- throw new \ InvalidArgumentException ("First key in \$update must NOT be a \$operator " );
203
+ throw new InvalidArgumentException ("First key in \$update must NOT be a \$operator " );
204
204
}
205
205
206
206
$ bulk ->update ($ args [0 ], $ args [1 ], $ options );
@@ -217,7 +217,7 @@ public function bulkWrite(array $bulk, array $options = array())
217
217
break ;
218
218
219
219
default :
220
- throw new \ InvalidArgumentException (sprintf ("Unknown operation type called '%s' (operation#%d) " , $ opname , $ n ));
220
+ throw new InvalidArgumentException (sprintf ("Unknown operation type called '%s' (operation#%d) " , $ opname , $ n ));
221
221
}
222
222
}
223
223
}
@@ -521,7 +521,7 @@ public function findOneAndReplace(array $filter, array $replacement, array $opti
521
521
{
522
522
$ firstKey = key ($ replacement );
523
523
if (isset ($ firstKey [0 ]) && $ firstKey [0 ] == '$ ' ) {
524
- throw new \ InvalidArgumentException ("First key in \$replacement must NOT be a \$operator " );
524
+ throw new InvalidArgumentException ("First key in \$replacement must NOT be a \$operator " );
525
525
}
526
526
527
527
$ options = array_merge ($ this ->getFindOneAndReplaceOptions (), $ options );
@@ -559,7 +559,7 @@ public function findOneAndUpdate(array $filter, array $update, array $options =
559
559
{
560
560
$ firstKey = key ($ update );
561
561
if (!isset ($ firstKey [0 ]) || $ firstKey [0 ] != '$ ' ) {
562
- throw new \ InvalidArgumentException ("First key in \$update must be a \$operator " );
562
+ throw new InvalidArgumentException ("First key in \$update must be a \$operator " );
563
563
}
564
564
565
565
$ options = array_merge ($ this ->getFindOneAndUpdateOptions (), $ options );
@@ -1036,7 +1036,7 @@ public function replaceOne(array $filter, array $update, array $options = array(
1036
1036
{
1037
1037
$ firstKey = key ($ update );
1038
1038
if (isset ($ firstKey [0 ]) && $ firstKey [0 ] == '$ ' ) {
1039
- throw new \ InvalidArgumentException ("First key in \$update must NOT be a \$operator " );
1039
+ throw new InvalidArgumentException ("First key in \$update must NOT be a \$operator " );
1040
1040
}
1041
1041
$ wr = $ this ->_update ($ filter , $ update , $ options );
1042
1042
@@ -1078,7 +1078,7 @@ public function updateOne(array $filter, array $update, array $options = array()
1078
1078
{
1079
1079
$ firstKey = key ($ update );
1080
1080
if (!isset ($ firstKey [0 ]) || $ firstKey [0 ] != '$ ' ) {
1081
- throw new \ InvalidArgumentException ("First key in \$update must be a \$operator " );
1081
+ throw new InvalidArgumentException ("First key in \$update must be a \$operator " );
1082
1082
}
1083
1083
$ wr = $ this ->_update ($ filter , $ update , $ options );
1084
1084
@@ -1134,10 +1134,10 @@ final protected function _delete($filter, $limit = 1)
1134
1134
final protected function _generateCommandException ($ doc )
1135
1135
{
1136
1136
if ($ doc ["errmsg " ]) {
1137
- return new Exception ($ doc ["errmsg " ]);
1137
+ return new RuntimeException ($ doc ["errmsg " ]);
1138
1138
}
1139
1139
var_dump ($ doc );
1140
- return new \ Exception ("FIXME: Unknown error " );
1140
+ return new RuntimeException ("FIXME: Unknown error " );
1141
1141
}
1142
1142
1143
1143
/**
0 commit comments