aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggBatch.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-23 15:07:03 -0500
committercash <cash.costello@gmail.com>2011-12-23 15:07:03 -0500
commit3d3312d47597249def3ed8efdcbf68869e3fef31 (patch)
tree44a14ca6546117218df32875ec6a338e601df33b /engine/classes/ElggBatch.php
parent1b657e860b966260ca88a0b0e91ee3d058a78a6a (diff)
downloadelgg-3d3312d47597249def3ed8efdcbf68869e3fef31.tar.gz
elgg-3d3312d47597249def3ed8efdcbf68869e3fef31.tar.bz2
Refs #4239 improved the documentation on ElggBatch for the limit option
Diffstat (limited to 'engine/classes/ElggBatch.php')
-rw-r--r--engine/classes/ElggBatch.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php
index 62128e34f..2a97f9ff5 100644
--- a/engine/classes/ElggBatch.php
+++ b/engine/classes/ElggBatch.php
@@ -92,7 +92,7 @@ class ElggBatch
/**
* Stop after this many results.
*
- * @var unknown_type
+ * @var int
*/
private $limit = 0;
@@ -147,7 +147,9 @@ class ElggBatch
*
* @param string $getter The function used to get objects. Usually
* an elgg_get_*() function, but can be any valid PHP callback.
- * @param array $options The options array to pass to the getter function
+ * @param array $options The options array to pass to the getter function. If limit is
+ * not set, 10 is used as the default. In most cases that is not
+ * what you want.
* @param mixed $callback An optional callback function that all results will be passed
* to upon load. The callback needs to accept $result, $getter,
* $options.
@@ -319,13 +321,13 @@ class ElggBatch
*/
public function next() {
// if we'll be at the end.
- if ($this->processedResults + 1 >= $this->limit && $this->limit > 0) {
+ if (($this->processedResults + 1) >= $this->limit && $this->limit > 0) {
$this->results = array();
return false;
}
// if we'll need new results.
- if ($this->resultIndex + 1 >= $this->chunkSize) {
+ if (($this->resultIndex + 1) >= $this->chunkSize) {
if (!$this->getNextResultsChunk()) {
$this->results = array();
return false;
@@ -356,4 +358,4 @@ class ElggBatch
$key = key($this->results);
return ($key !== NULL && $key !== FALSE);
}
-} \ No newline at end of file
+}