setOptions($options); } } /** * setOptions() - standard issue implementation, this will set any * options that are supported via a set method. * * @param array $options * @return Zend_Tool_Framework_Metadata_Basic */ public function setOptions(Array $options) { foreach ($options as $optionName => $optionValue) { $setMethod = 'set' . $optionName; if (method_exists($this, $setMethod)) { $this->{$setMethod}($optionValue); } } return $this; } /** * getType() * * @return string */ public function getType() { return $this->_type; } /** * setType() * * @param string $type * @return Zend_Tool_Framework_Metadata_Basic */ public function setType($type) { $this->_type = $type; return $this; } /** * getName() * * @return string */ public function getName() { return $this->_name; } /** * setName() * * @param string $name * @return Zend_Tool_Framework_Metadata_Basic */ public function setName($name) { $this->_name = $name; return $this; } /** * getValue() * * @return mixed */ public function getValue() { return $this->_value; } /** * setValue() * * @param unknown_type $Value * @return Zend_Tool_Framework_Metadata_Basic */ public function setValue($value) { $this->_value = $value; return $this; } /** * setReference() * * @param mixed $reference * @return Zend_Tool_Framework_Metadata_Basic */ public function setReference($reference) { $this->_reference = $reference; return $this; } /** * getReference() * * @return mixed */ public function getReference() { return $this->_reference; } /** * getAttributes() - this will retrieve any attributes of this object that exist as properties * This is most useful for printing metadata. * * @param const $type * @return array */ public function getAttributes($type = self::ATTRIBUTES_ALL, $stringRepresentationOfNonScalars = false) { $thisReflection = new ReflectionObject($this); $metadataPairValues = array(); foreach (get_object_vars($this) as $varName => $varValue) { if ($type == self::ATTRIBUTES_NO_PARENT && ($thisReflection->getProperty($varName)->getDeclaringClass()->getName() == 'Zend_Tool_Framework_Metadata_Basic')) { continue; } if ($stringRepresentationOfNonScalars) { if (is_object($varValue)) { $varValue = '(object)'; } if (is_null($varValue)) { $varValue = '(null)'; } } $metadataPairValues[ltrim($varName, '_')] = $varValue; } return $metadataPairValues; } /** * __toString() - string representation of this object * * @return string */ public function __toString() { return 'Type: ' . $this->_type . ', Name: ' . $this->_name . ', Value: ' . (is_array($this->_value) ? http_build_query($this->_value) : (string) $this->_value); } }