From: Michael M Slusarz Date: Thu, 7 Oct 2010 06:07:55 +0000 (-0600) Subject: Implement Countable and Iterator interfaces for Horde_Variables::. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fc9ac54bb2038b2ee16ec3ba62c5e03d6baec5f6;p=horde.git Implement Countable and Iterator interfaces for Horde_Variables::. --- diff --git a/framework/Util/lib/Horde/Variables.php b/framework/Util/lib/Horde/Variables.php index 97b739f20..68da55f77 100644 --- a/framework/Util/lib/Horde/Variables.php +++ b/framework/Util/lib/Horde/Variables.php @@ -13,7 +13,7 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @package Util */ -class Horde_Variables +class Horde_Variables implements Countable, Iterator { /** * Array of form variables. @@ -87,16 +87,6 @@ class Horde_Variables } /** - * Return the number of form variables. - * - * @return integer The count of variables. - */ - public function count() - { - return count($this->_vars); - } - - /** * Alias of isset(). * * @param string $varname The form variable name. @@ -323,4 +313,40 @@ class Horde_Variables return !is_null($value); } + /* Countable methods. */ + + /** + */ + public function count() + { + return count($this->_vars); + } + + /* Iterator methods. */ + + public function current() + { + return current($this->_vars); + } + + public function key() + { + return key($this->_vars); + } + + public function next() + { + next($this->_vars); + } + + public function rewind() + { + reset($this->_vars); + } + + public function valid() + { + return (key($this->_vars) !== null); + } + }