]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #4239 improved the documentation on ElggBatch for the limit option
authorcash <cash.costello@gmail.com>
Fri, 23 Dec 2011 20:07:03 +0000 (15:07 -0500)
committercash <cash.costello@gmail.com>
Fri, 23 Dec 2011 20:07:03 +0000 (15:07 -0500)
engine/classes/ElggBatch.php

index 62128e34f30f4f7c46cc76d0d9be420d3c288f90..2a97f9ff51cdc5b001991019cb6815b6720e4648 100644 (file)
@@ -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
+}