diff -r 5e7a0fedabdf -r 877f952ae2bd web/lib/Zend/Cloud/DocumentService/Document.php --- a/web/lib/Zend/Cloud/DocumentService/Document.php Thu Mar 21 17:31:31 2013 +0100 +++ b/web/lib/Zend/Cloud/DocumentService/Document.php Thu Mar 21 19:50:53 2013 +0100 @@ -1,248 +1,248 @@ -_fields = $fields; - $this->setId($id); - } - - /** - * Set document identifier - * - * @param mixed $id - * @return Zend_Cloud_DocumentService_Document - */ - public function setId($id) - { - $this->_id = $id; - return $this; - } - - /** - * Get ID name. - * - * @return string - */ - public function getId() - { - return $this->_id; - } - - /** - * Get fields as array. - * - * @return array - */ - public function getFields() - { - return $this->_fields; - } - - /** - * Get field by name. - * - * @param string $name - * @return mixed - */ - public function getField($name) - { - if (isset($this->_fields[$name])) { - return $this->_fields[$name]; - } - return null; - } - - /** - * Set field by name. - * - * @param string $name - * @param mixed $value - * @return Zend_Cloud_DocumentService_Document - */ - public function setField($name, $value) - { - $this->_fields[$name] = $value; - return $this; - } - - /** - * Overloading: get value - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - return $this->getField($name); - } - - /** - * Overloading: set field - * - * @param string $name - * @param mixed $value - * @return void - */ - public function __set($name, $value) - { - $this->setField($name, $value); - } - - /** - * ArrayAccess: does field exist? - * - * @param string $name - * @return bool - */ - public function offsetExists($name) - { - return isset($this->_fields[$name]); - } - - /** - * ArrayAccess: get field by name - * - * @param string $name - * @return mixed - */ - public function offsetGet($name) - { - return $this->getField($name); - } - - /** - * ArrayAccess: set field to value - * - * @param string $name - * @param mixed $value - * @return void - */ - public function offsetSet($name, $value) - { - $this->setField($name, $value); - } - - /** - * ArrayAccess: remove field from document - * - * @param string $name - * @return void - */ - public function offsetUnset($name) - { - if ($this->offsetExists($name)) { - unset($this->_fields[$name]); - } - } - - /** - * Overloading: retrieve and set fields by name - * - * @param string $name - * @param mixed $args - * @return mixed - */ - public function __call($name, $args) - { - $prefix = substr($name, 0, 3); - if ($prefix == 'get') { - // Get value - $option = substr($name, 3); - return $this->getField($option); - } elseif ($prefix == 'set') { - // set value - $option = substr($name, 3); - return $this->setField($option, $args[0]); - } - - require_once 'Zend/Cloud/OperationNotAvailableException.php'; - throw new Zend_Cloud_OperationNotAvailableException("Unknown operation $name"); - } - - /** - * Countable: return count of fields in document - * - * @return int - */ - public function count() - { - return count($this->_fields); - } - - /** - * IteratorAggregate: return iterator for iterating over fields - * - * @return Iterator - */ - public function getIterator() - { - return new ArrayIterator($this->_fields); - } -} +_fields = $fields; + $this->setId($id); + } + + /** + * Set document identifier + * + * @param mixed $id + * @return Zend_Cloud_DocumentService_Document + */ + public function setId($id) + { + $this->_id = $id; + return $this; + } + + /** + * Get ID name. + * + * @return string + */ + public function getId() + { + return $this->_id; + } + + /** + * Get fields as array. + * + * @return array + */ + public function getFields() + { + return $this->_fields; + } + + /** + * Get field by name. + * + * @param string $name + * @return mixed + */ + public function getField($name) + { + if (isset($this->_fields[$name])) { + return $this->_fields[$name]; + } + return null; + } + + /** + * Set field by name. + * + * @param string $name + * @param mixed $value + * @return Zend_Cloud_DocumentService_Document + */ + public function setField($name, $value) + { + $this->_fields[$name] = $value; + return $this; + } + + /** + * Overloading: get value + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + return $this->getField($name); + } + + /** + * Overloading: set field + * + * @param string $name + * @param mixed $value + * @return void + */ + public function __set($name, $value) + { + $this->setField($name, $value); + } + + /** + * ArrayAccess: does field exist? + * + * @param string $name + * @return bool + */ + public function offsetExists($name) + { + return isset($this->_fields[$name]); + } + + /** + * ArrayAccess: get field by name + * + * @param string $name + * @return mixed + */ + public function offsetGet($name) + { + return $this->getField($name); + } + + /** + * ArrayAccess: set field to value + * + * @param string $name + * @param mixed $value + * @return void + */ + public function offsetSet($name, $value) + { + $this->setField($name, $value); + } + + /** + * ArrayAccess: remove field from document + * + * @param string $name + * @return void + */ + public function offsetUnset($name) + { + if ($this->offsetExists($name)) { + unset($this->_fields[$name]); + } + } + + /** + * Overloading: retrieve and set fields by name + * + * @param string $name + * @param mixed $args + * @return mixed + */ + public function __call($name, $args) + { + $prefix = substr($name, 0, 3); + if ($prefix == 'get') { + // Get value + $option = substr($name, 3); + return $this->getField($option); + } elseif ($prefix == 'set') { + // set value + $option = substr($name, 3); + return $this->setField($option, $args[0]); + } + + require_once 'Zend/Cloud/OperationNotAvailableException.php'; + throw new Zend_Cloud_OperationNotAvailableException("Unknown operation $name"); + } + + /** + * Countable: return count of fields in document + * + * @return int + */ + public function count() + { + return count($this->_fields); + } + + /** + * IteratorAggregate: return iterator for iterating over fields + * + * @return Iterator + */ + public function getIterator() + { + return new ArrayIterator($this->_fields); + } +}