aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-09-02 12:19:26 -0300
committerSilvio <silvio@devlet.com.br>2010-09-02 12:19:26 -0300
commit362ae2205baedb31c188d2cbc3e3f671749e88ea (patch)
tree932b8c860f0a44d06cf9d68474fb9e9b29912fcd /classes
parentd7fbda5c30faae0859e59e783cb1ea772e98532d (diff)
downloadcinisis-362ae2205baedb31c188d2cbc3e3f671749e88ea.tar.gz
cinisis-362ae2205baedb31c188d2cbc3e3f671749e88ea.tar.bz2
IsisMethodIterator accepting an optional second class parameter
Diffstat (limited to 'classes')
-rw-r--r--classes/iterators/IsisMethodIterator.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/classes/iterators/IsisMethodIterator.php b/classes/iterators/IsisMethodIterator.php
index e5188d3..95f4467 100644
--- a/classes/iterators/IsisMethodIterator.php
+++ b/classes/iterators/IsisMethodIterator.php
@@ -6,21 +6,26 @@
class IsisMethodIterator implements Iterator
{
private $total = 0;
- private $class;
+ private $isis;
private $keys;
private $position = -1;
/**
* Constructor.
*
- * @param $class
+ * @param $isis
* Instance of IsisConnector or child class.
+ *
+ * @param $class
+ * Optional class where to look for methods, defaults
+ * to $isis itself.
*/
- public function __construct($class) {
+ public function __construct($isis, $class = NULL) {
// Setup.
- $this->class = $class;
- $this->total = count($class->fields);
- $this->keys = array_keys($class->fields);
+ $this->isis = $isis;
+ $this->total = count($isis->fields);
+ $this->keys = array_keys($isis->fields);
+ $this->class = ($class == null) ? $isis : $class;
// Find the first valid occurrence.
$this->next();
@@ -38,15 +43,15 @@ class IsisMethodIterator implements Iterator
* Return the key of the current element.
*/
function key() {
- $type = $this->class->getMapType($this->current());
- return $this->class->methodName($type);
+ $type = $this->isis->getMapType($this->current());
+ return $this->isis->methodName($type);
}
/**
* Return the current element.
*/
function current() {
- return $this->class->fields[$this->keys[$this->position]];
+ return $this->isis->fields[$this->keys[$this->position]];
}
/**