We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e62cab commit a20fa27Copy full SHA for a20fa27
src/Model/CollectionInfoLegacyIterator.php
@@ -3,9 +3,29 @@
3
namespace MongoDB\Model;
4
5
use FilterIterator;
6
+use Iterator;
7
+use IteratorIterator;
8
+use Traversable;
9
10
class CollectionInfoLegacyIterator extends FilterIterator implements CollectionInfoIterator
11
{
12
+ /**
13
+ * Constructor.
14
+ *
15
+ * @param Traversable $iterator
16
+ */
17
+ public function __construct(Traversable $iterator)
18
+ {
19
+ /* FilterIterator requires an Iterator, so wrap all other Traversables
20
+ * with an IteratorIterator as a convenience.
21
22
+ if ( ! $iterator instanceof Iterator) {
23
+ $iterator = new IteratorIterator($iterator);
24
+ }
25
+
26
+ parent::__construct($iterator);
27
28
29
/**
30
* Return the current element as a CollectionInfo instance.
31
*
0 commit comments