/** * * @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); }
/** * Construct the element repeater * * @param \Zend_Form $form */ public function __construct(\Zend_Form $form) { parent::__construct($form); // Enable access to the elements in this repeater using: // $this->element and $this->label. // // The other access method is: $this->{name of element renderer} $this->element = new \MUtil_Lazy_Call(array($this, '__current')); $this->label = \MUtil_Html::create('label', $this->element); }