/** * Returns a value for $name * * @param string $name A name indentifying a value in this stack. * @return A value for $name */ public function lazyGet($name) { // \MUtil_Echo::track($name, isset($this->_object->$name), \MUtil_Lazy::rise($this->_object->$name), $this->_object->getLazyValue($name)); $value = $this->_object->__get($name); if ($value instanceof \MUtil_Lazy_LazyInterface) { return \MUtil_Lazy::rise($value); } return $value; }
/** * * @param array|Traversable $data * @throws \MUtil_Lazy_LazyException */ public function __construct($data) { if (!(is_array($data) || $data instanceof \Traversable)) { throw new \MUtil_Lazy_LazyException('The $data parameter is not an array or a \\Traversable interface instance '); } $result = array(); foreach ($data as $key => $value) { $result[] = array('key' => $key, 'value' => $value); } parent::__construct($result); }
public function __construct($data) { $result = array(); $cvars = get_class_vars(get_class($data)); $vars = get_object_vars($data); if (count($vars)) { foreach ($vars as $name => $value) { $result[] = array('name' => $name, 'value' => \MUtil_Lazy::property($data, $name), 'from_code' => array_key_exists($name, $cvars)); } $this->_hasProperties = true; } else { $this->_hasProperties = false; } parent::__construct($result); }
/** * Return the core data in the Repeatable in one go * * @return \Iterator|array */ public function __getRepeatable() { $elements = iterator_to_array(parent::__getRepeatable()); if ($this->flattenSubs) { $newElements = array(); foreach ($elements as $element) { $this->_flattenElement($element, $newElements); } $elements = $newElements; } if ($this->splitHidden) { $filteredElements = array(); $this->_hidden_elements = array(); foreach ($elements as $element) { if ($element instanceof \Zend_Form_Element_Hidden || $element instanceof \Zend_Form_Element_Hash) { $this->_hidden_elements[] = $element; } else { $filteredElements[] = $element; } } return $filteredElements; } else { $this->_hidden_elements = array(); return $elements; } }