Also implement the Countable interface for full array-like compatibility
This commit is contained in:
parent
c2b87d4ad5
commit
1daa305faa
1 changed files with 9 additions and 1 deletions
|
@ -24,7 +24,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class kolab_storage_dataset implements Iterator, ArrayAccess
|
||||
class kolab_storage_dataset implements Iterator, ArrayAccess, Countable
|
||||
{
|
||||
private $cache; // kolab_storage_cache instance to use for fetching data
|
||||
private $memlimit = 0;
|
||||
|
@ -50,6 +50,14 @@ class kolab_storage_dataset implements Iterator, ArrayAccess
|
|||
}
|
||||
|
||||
|
||||
/*** Implement PHP Countable interface ***/
|
||||
|
||||
public function count()
|
||||
{
|
||||
return count($this->index);
|
||||
}
|
||||
|
||||
|
||||
/*** Implement PHP ArrayAccess interface ***/
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
|
|
Loading…
Add table
Reference in a new issue