/** * Get a property * * Method provides support for computed properties by calling an getProperty[CamelizedName] if it exists. The getter * should return the computed value to get. * * @param string $name The property name * @return mixed The property value. */ public function getProperty($name) { //Handle computed properties if (!$this->hasProperty($name) && !empty($name)) { $getter = 'getProperty' . KStringInflector::camelize($name); $methods = $this->getMethods(); if (isset($methods[$getter])) { parent::offsetSet($name, $this->{$getter}()); } } return parent::offsetGet($name); }
/** * Get an item from the array by offset * * Required by interface ArrayAccess * * @param int $offset * @return mixed The item from the array */ public function offsetGet($offset) { return KObjectArray::offsetGet($offset); }
/** * Overridden current() method * * Used to delay de creation of KDatabaseRow objects, for performance reasons * * @return KDatabaseRowAbstract Current element from the collection */ public function current() { if ($this->valid() === false) { return null; } // do we already have a row object for this position? if (!isset($this[$this->key()])) { // cloning is faster than instantiating $row = clone $this->_emptyRow; $row->setProperties($this->_data[$this->key()]); parent::offsetSet($this->key(), $row); } // return the row object return parent::offsetGet($this->key()); }