diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Tool/Framework/Metadata/Dynamic.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Tool/Framework/Metadata/Dynamic.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,219 @@ +setOptions($options); + } + } + + public function setOptions(Array $options = array()) + { + foreach ($options as $optName => $optValue) { + $methodName = 'set' . $optName; + $this->{$methodName}($optValue); + } + } + + /** + * setType() + * + * @param $type + * @return Zend_Tool_Framework_Metadata_Dynamic + */ + public function setType($type) + { + $this->_type = $type; + return $this; + } + + /** + * getType() + * + * The type of metadata this describes + * + * @return string + */ + public function getType() + { + return $this->_type; + } + + /** + * setName() + * + * @param $name + * @return Zend_Tool_Framework_Metadata_Dynamic + */ + public function setName($name) + { + $this->_name = $name; + return $this; + } + + /** + * getName() + * + * Metadata name + * + * @return string + */ + public function getName() + { + return $this->_name; + } + + /** + * setValue() + * + * @param $value + * @return Zend_Tool_Framework_Metadata_Dynamic + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * getValue() + * + * Metadata Value + * + * @return string + */ + public function getValue() + { + return $this->_value; + } + + public function getAttributes() + { + return $this->_dynamicAttributes; + } + + /** + * __isset() + * + * Check if an attrbute is set + * + * @param string $name + * @return bool + */ + public function __isset($name) + { + return isset($this->_dynamicAttributes[$name]); + } + + /** + * __unset() + * + * @param string $name + * @return null + */ + public function __unset($name) + { + unset($this->_dynamicAttributes[$name]); + return; + } + + /** + * __get() - Get a property via property call $metadata->foo + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + if (method_exists($this, 'get' . $name)) { + return $this->{'get' . $name}(); + } elseif (array_key_exists($name, $this->_dynamicAttributes)) { + return $this->_dynamicAttributes[$name]; + } else { + require_once 'Zend/Tool/Framework/Registry/Exception.php'; + throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this metadata.'); + } + } + + /** + * __set() - Set a property via the magic set $metadata->foo = 'foo' + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + if (method_exists($this, 'set' . $name)) { + $this->{'set' . $name}($value); + return $this; + } else { + $this->_dynamicAttributes[$name] = $value; + return $this; + } +// { +// require_once 'Zend/Tool/Framework/Registry/Exception.php'; +// throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this registry.'); +// } + } + +}