File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change 4141use function is_array ;
4242use function is_object ;
4343use function is_string ;
44- use function key ;
4544use function MongoDB \BSON \fromPHP ;
4645use function MongoDB \BSON \toPHP ;
47- use function reset ;
4846use function substr ;
4947
5048/**
@@ -319,11 +317,9 @@ function is_last_pipeline_operator_write(array $pipeline): bool
319317 return false ;
320318 }
321319
322- $ lastOp = document_to_array ($ lastOp );
320+ $ key = array_key_first ( document_to_array ($ lastOp) );
323321
324- reset ($ lastOp );
325-
326- return key ($ lastOp ) === '$merge ' || key ($ lastOp ) === '$out ' ;
322+ return $ key === '$merge ' || $ key === '$out ' ;
327323}
328324
329325/**
@@ -341,11 +337,7 @@ function is_mapreduce_output_inline($out): bool
341337 return false ;
342338 }
343339
344- $ out = document_to_array ($ out );
345-
346- reset ($ out );
347-
348- return key ($ out ) === 'inline ' ;
340+ return array_key_first (document_to_array ($ out )) === 'inline ' ;
349341}
350342
351343/**
You can’t perform that action at this time.
0 commit comments