summaryrefslogtreecommitdiff
path: root/framework/TComponent.php
diff options
context:
space:
mode:
authorrojaro <>2009-11-01 21:32:45 +0000
committerrojaro <>2009-11-01 21:32:45 +0000
commit56d36fdd34e79ba1870f2d49c5dbd4ee3653cfbd (patch)
tree0cdba02beeb47afaeb3d4a3b9a151103fba9054d /framework/TComponent.php
parent704dd5ead2bf3a6858bb07f1186183c84210d307 (diff)
TEnumerable can now be iterated as suggested by FragMaster B
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r--framework/TComponent.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 2fc0ebff..647653dd 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -608,8 +608,34 @@ class TComponent
* @package System
* @since 3.0
*/
-class TEnumerable
+class TEnumerable implements Iterator
{
+ private $_enums = array();
+
+ public function __construct() {
+ $reflection = new ReflectionClass($this);
+ $this->_enums = $reflection->getConstants();
+ }
+
+ public function current() {
+ return current($this->_enums);
+ }
+
+ public function key() {
+ return key($this->_enums);
+ }
+
+ public function next() {
+ return next($this->_enums);
+ }
+
+ public function rewind() {
+ reset($this->_enums);
+ }
+
+ public function valid() {
+ return $this->current() !== false;
+ }
}
/**