@@ -124,83 +124,83 @@ public function __construct(private string $databaseName, private ?string $colle
124
124
throw new InvalidArgumentException ('$pipeline is not a valid aggregation pipeline ' );
125
125
}
126
126
127
- if (isset ($ options ['allowDiskUse ' ]) && ! is_bool ($ options ['allowDiskUse ' ])) {
128
- throw InvalidArgumentException::invalidType ('"allowDiskUse" option ' , $ options ['allowDiskUse ' ], 'boolean ' );
127
+ if (isset ($ this -> options ['allowDiskUse ' ]) && ! is_bool ($ this -> options ['allowDiskUse ' ])) {
128
+ throw InvalidArgumentException::invalidType ('"allowDiskUse" option ' , $ this -> options ['allowDiskUse ' ], 'boolean ' );
129
129
}
130
130
131
- if (isset ($ options ['batchSize ' ]) && ! is_integer ($ options ['batchSize ' ])) {
132
- throw InvalidArgumentException::invalidType ('"batchSize" option ' , $ options ['batchSize ' ], 'integer ' );
131
+ if (isset ($ this -> options ['batchSize ' ]) && ! is_integer ($ this -> options ['batchSize ' ])) {
132
+ throw InvalidArgumentException::invalidType ('"batchSize" option ' , $ this -> options ['batchSize ' ], 'integer ' );
133
133
}
134
134
135
- if (isset ($ options ['bypassDocumentValidation ' ]) && ! is_bool ($ options ['bypassDocumentValidation ' ])) {
136
- throw InvalidArgumentException::invalidType ('"bypassDocumentValidation" option ' , $ options ['bypassDocumentValidation ' ], 'boolean ' );
135
+ if (isset ($ this -> options ['bypassDocumentValidation ' ]) && ! is_bool ($ this -> options ['bypassDocumentValidation ' ])) {
136
+ throw InvalidArgumentException::invalidType ('"bypassDocumentValidation" option ' , $ this -> options ['bypassDocumentValidation ' ], 'boolean ' );
137
137
}
138
138
139
- if (isset ($ options ['codec ' ]) && ! $ options ['codec ' ] instanceof DocumentCodec) {
140
- throw InvalidArgumentException::invalidType ('"codec" option ' , $ options ['codec ' ], DocumentCodec::class);
139
+ if (isset ($ this -> options ['codec ' ]) && ! $ this -> options ['codec ' ] instanceof DocumentCodec) {
140
+ throw InvalidArgumentException::invalidType ('"codec" option ' , $ this -> options ['codec ' ], DocumentCodec::class);
141
141
}
142
142
143
- if (isset ($ options ['collation ' ]) && ! is_document ($ options ['collation ' ])) {
144
- throw InvalidArgumentException::expectedDocumentType ('"collation" option ' , $ options ['collation ' ]);
143
+ if (isset ($ this -> options ['collation ' ]) && ! is_document ($ this -> options ['collation ' ])) {
144
+ throw InvalidArgumentException::expectedDocumentType ('"collation" option ' , $ this -> options ['collation ' ]);
145
145
}
146
146
147
- if (isset ($ options ['explain ' ]) && ! is_bool ($ options ['explain ' ])) {
148
- throw InvalidArgumentException::invalidType ('"explain" option ' , $ options ['explain ' ], 'boolean ' );
147
+ if (isset ($ this -> options ['explain ' ]) && ! is_bool ($ this -> options ['explain ' ])) {
148
+ throw InvalidArgumentException::invalidType ('"explain" option ' , $ this -> options ['explain ' ], 'boolean ' );
149
149
}
150
150
151
- if (isset ($ options ['hint ' ]) && ! is_string ($ options ['hint ' ]) && ! is_array ($ options ['hint ' ]) && ! is_object ($ options ['hint ' ])) {
152
- throw InvalidArgumentException::invalidType ('"hint" option ' , $ options ['hint ' ], 'string or array or object ' );
151
+ if (isset ($ this -> options ['hint ' ]) && ! is_string ($ this -> options ['hint ' ]) && ! is_array ($ this -> options ['hint ' ]) && ! is_object ($ this -> options ['hint ' ])) {
152
+ throw InvalidArgumentException::invalidType ('"hint" option ' , $ this -> options ['hint ' ], 'string or array or object ' );
153
153
}
154
154
155
- if (isset ($ options ['let ' ]) && ! is_document ($ options ['let ' ])) {
156
- throw InvalidArgumentException::expectedDocumentType ('"let" option ' , $ options ['let ' ]);
155
+ if (isset ($ this -> options ['let ' ]) && ! is_document ($ this -> options ['let ' ])) {
156
+ throw InvalidArgumentException::expectedDocumentType ('"let" option ' , $ this -> options ['let ' ]);
157
157
}
158
158
159
- if (isset ($ options ['maxAwaitTimeMS ' ]) && ! is_integer ($ options ['maxAwaitTimeMS ' ])) {
160
- throw InvalidArgumentException::invalidType ('"maxAwaitTimeMS" option ' , $ options ['maxAwaitTimeMS ' ], 'integer ' );
159
+ if (isset ($ this -> options ['maxAwaitTimeMS ' ]) && ! is_integer ($ this -> options ['maxAwaitTimeMS ' ])) {
160
+ throw InvalidArgumentException::invalidType ('"maxAwaitTimeMS" option ' , $ this -> options ['maxAwaitTimeMS ' ], 'integer ' );
161
161
}
162
162
163
- if (isset ($ options ['maxTimeMS ' ]) && ! is_integer ($ options ['maxTimeMS ' ])) {
164
- throw InvalidArgumentException::invalidType ('"maxTimeMS" option ' , $ options ['maxTimeMS ' ], 'integer ' );
163
+ if (isset ($ this -> options ['maxTimeMS ' ]) && ! is_integer ($ this -> options ['maxTimeMS ' ])) {
164
+ throw InvalidArgumentException::invalidType ('"maxTimeMS" option ' , $ this -> options ['maxTimeMS ' ], 'integer ' );
165
165
}
166
166
167
- if (isset ($ options ['readConcern ' ]) && ! $ options ['readConcern ' ] instanceof ReadConcern) {
168
- throw InvalidArgumentException::invalidType ('"readConcern" option ' , $ options ['readConcern ' ], ReadConcern::class);
167
+ if (isset ($ this -> options ['readConcern ' ]) && ! $ this -> options ['readConcern ' ] instanceof ReadConcern) {
168
+ throw InvalidArgumentException::invalidType ('"readConcern" option ' , $ this -> options ['readConcern ' ], ReadConcern::class);
169
169
}
170
170
171
- if (isset ($ options ['readPreference ' ]) && ! $ options ['readPreference ' ] instanceof ReadPreference) {
172
- throw InvalidArgumentException::invalidType ('"readPreference" option ' , $ options ['readPreference ' ], ReadPreference::class);
171
+ if (isset ($ this -> options ['readPreference ' ]) && ! $ this -> options ['readPreference ' ] instanceof ReadPreference) {
172
+ throw InvalidArgumentException::invalidType ('"readPreference" option ' , $ this -> options ['readPreference ' ], ReadPreference::class);
173
173
}
174
174
175
- if (isset ($ options ['session ' ]) && ! $ options ['session ' ] instanceof Session) {
176
- throw InvalidArgumentException::invalidType ('"session" option ' , $ options ['session ' ], Session::class);
175
+ if (isset ($ this -> options ['session ' ]) && ! $ this -> options ['session ' ] instanceof Session) {
176
+ throw InvalidArgumentException::invalidType ('"session" option ' , $ this -> options ['session ' ], Session::class);
177
177
}
178
178
179
- if (isset ($ options ['typeMap ' ]) && ! is_array ($ options ['typeMap ' ])) {
180
- throw InvalidArgumentException::invalidType ('"typeMap" option ' , $ options ['typeMap ' ], 'array ' );
179
+ if (isset ($ this -> options ['typeMap ' ]) && ! is_array ($ this -> options ['typeMap ' ])) {
180
+ throw InvalidArgumentException::invalidType ('"typeMap" option ' , $ this -> options ['typeMap ' ], 'array ' );
181
181
}
182
182
183
- if (isset ($ options ['writeConcern ' ]) && ! $ options ['writeConcern ' ] instanceof WriteConcern) {
184
- throw InvalidArgumentException::invalidType ('"writeConcern" option ' , $ options ['writeConcern ' ], WriteConcern::class);
183
+ if (isset ($ this -> options ['writeConcern ' ]) && ! $ this -> options ['writeConcern ' ] instanceof WriteConcern) {
184
+ throw InvalidArgumentException::invalidType ('"writeConcern" option ' , $ this -> options ['writeConcern ' ], WriteConcern::class);
185
185
}
186
186
187
- if (isset ($ options ['bypassDocumentValidation ' ]) && ! $ options ['bypassDocumentValidation ' ]) {
187
+ if (isset ($ this -> options ['bypassDocumentValidation ' ]) && ! $ this -> options ['bypassDocumentValidation ' ]) {
188
188
unset($ this ->options ['bypassDocumentValidation ' ]);
189
189
}
190
190
191
- if (isset ($ options ['readConcern ' ]) && $ options ['readConcern ' ]->isDefault ()) {
191
+ if (isset ($ this -> options ['readConcern ' ]) && $ this -> options ['readConcern ' ]->isDefault ()) {
192
192
unset($ this ->options ['readConcern ' ]);
193
193
}
194
194
195
- if (isset ($ options ['writeConcern ' ]) && $ options ['writeConcern ' ]->isDefault ()) {
195
+ if (isset ($ this -> options ['writeConcern ' ]) && $ this -> options ['writeConcern ' ]->isDefault ()) {
196
196
unset($ this ->options ['writeConcern ' ]);
197
197
}
198
198
199
- if (isset ($ options ['codec ' ]) && isset ($ options ['typeMap ' ])) {
199
+ if (isset ($ this -> options ['codec ' ]) && isset ($ this -> options ['typeMap ' ])) {
200
200
throw InvalidArgumentException::cannotCombineCodecAndTypeMap ();
201
201
}
202
202
203
- $ this ->isWrite = is_last_pipeline_operator_write ($ pipeline ) && ! ($ options ['explain ' ] ?? false );
203
+ $ this ->isWrite = is_last_pipeline_operator_write ($ pipeline ) && ! ($ this -> options ['explain ' ] ?? false );
204
204
205
205
if ($ this ->isWrite ) {
206
206
/* Ignore batchSize for writes, since no documents are returned and
0 commit comments