8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * User-provided review
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Books_Extension_Review extends Zend_Gdata_Extension
41 protected $_rootNamespace = 'gbs';
42 protected $_rootElement = 'review';
43 protected $_lang = null;
44 protected $_type = null;
47 * Constructor for Zend_Gdata_Books_Extension_Review which
48 * User-provided review
50 * @param string|null $lang Review language.
51 * @param string|null $type Type of text construct (typically text, html,
53 * @param string|null $value Text content of the review.
55 public function __construct($lang = null, $type = null, $value = null)
57 $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
58 parent::__construct();
61 $this->_text = $value;
65 * Retrieves DOMElement which corresponds to this element and all
66 * child properties. This is used to build this object back into a DOM
67 * and eventually XML text for sending to the server upon updates, or
68 * for application storage/persistance.
70 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
71 * @return DOMElement The DOMElement representing this element and all
74 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
76 $element = parent::getDOM($doc);
77 if ($this->_lang !== null) {
78 $element->setAttribute('lang', $this->_lang);
80 if ($this->_type !== null) {
81 $element->setAttribute('type', $this->_type);
87 * Extracts XML attributes from the DOM and converts them to the
88 * appropriate object members.
90 * @param DOMNode $attribute The DOMNode attribute to be handled.
92 protected function takeAttributeFromDOM($attribute)
94 switch ($attribute->localName) {
96 $this->_lang = $attribute->nodeValue;
99 $this->_type = $attribute->nodeValue;
102 parent::takeAttributeFromDOM($attribute);
107 * Returns the language of link title
109 * @return string The lang
111 public function getLang()
117 * Returns the type of text construct (typically 'text', 'html' or 'xhtml')
119 * @return string The type
121 public function getType()
127 * Sets the language of link title
129 * @param string $lang language of link title
130 * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
132 public function setLang($lang)
134 $this->_lang = $lang;
139 * Sets the type of text construct (typically 'text', 'html' or 'xhtml')
141 * @param string $type type of text construct (typically 'text', 'html' or 'xhtml')
142 * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
144 public function setType($type)
146 $this->_type = $type;