Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11723319
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/includes/collection/MongoDBCollectionIterator.php b/includes/collection/MongoDBCollectionIterator.php
index 715bc78..abbbd26 100644
--- a/includes/collection/MongoDBCollectionIterator.php
+++ b/includes/collection/MongoDBCollectionIterator.php
@@ -1,81 +1,86 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
- * MongoDB colletction iterator class
+ * MongoDB collection iterator class
*
* @package ObsidianWorkspaces
* @subpackage Collection
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*/
/**
* Iterator for MongoDBCollection::getAll()
*/
class MongoDBCollectionIterator implements Iterator {
/**
* @var MongoCursor The MongoDB cursor
*/
private $cursor;
/**
* @var MongoDBCollection The collection attached to the current iterator instance
*/
private $collection;
/**
* Initializes a new instance of the MongoDBCollectionIterator object
*
* @param MongoDBCollection $collection The collection to itrate
* @param MongoCursor $cursor The cursor to the results [optional]
*/
public function __construct (MongoDBCollection $collection, MongoCursor $cursor = null) {
$this->collection = $collection;
if ($cursor === null) {
$this->cursor = $collection->mongoCollection->find();
} else {
$this->cursor = $cursor;
}
}
/**
- * Returns the current element
+ * Returns a collection document from the current result
+ * @return CollectionDocument the current result's document
*/
public function current () {
- return $this->collection->getDocumentFromArray($this->cursor->current());
+ return $this->collection->getDocumentFromArray(
+ $this->cursor->current()
+ );
}
/**
* Returns the key of the current element
+ * @return string the current result's _id
*/
public function key () {
return $this->cursor->key();
}
/**
* Moves forward to next element
*/
public function next () {
$this->cursor->next();
}
/**
* Rewinds the iterator to the first element
*/
public function rewind () {
$this->cursor->rewind();
}
/**
* Checks if current position is valid
+ * @return boolean true if the current position is valid ; otherwise, false
*/
public function valid () {
return $this->cursor->valid();
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Sep 18, 09:34 (17 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2990342
Default Alt Text
(2 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment