[44] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Zend Framework
|
---|
| 5 | *
|
---|
| 6 | * LICENSE
|
---|
| 7 | *
|
---|
| 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.
|
---|
| 15 | *
|
---|
| 16 | * @category Zend
|
---|
| 17 | * @package Zend_Gdata
|
---|
| 18 | * @subpackage Books
|
---|
| 19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc.
|
---|
| 20 | * (http://www.zend.com)
|
---|
| 21 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 22 | */
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * @see Zend_Gdata_Extension
|
---|
| 26 | */
|
---|
| 27 | require_once 'Zend/Gdata/Extension.php';
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * User-provided review
|
---|
| 31 | *
|
---|
| 32 | * @category Zend
|
---|
| 33 | * @package Zend_Gdata
|
---|
| 34 | * @subpackage Books
|
---|
| 35 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc.
|
---|
| 36 | * (http://www.zend.com)
|
---|
| 37 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 38 | */
|
---|
| 39 | class Zend_Gdata_Books_Extension_Review extends Zend_Gdata_Extension
|
---|
| 40 | {
|
---|
| 41 |
|
---|
| 42 | protected $_rootNamespace = 'gbs';
|
---|
| 43 | protected $_rootElement = 'review';
|
---|
| 44 | protected $_lang = null;
|
---|
| 45 | protected $_type = null;
|
---|
| 46 |
|
---|
| 47 | /**
|
---|
| 48 | * Constructor for Zend_Gdata_Books_Extension_Review which
|
---|
| 49 | * User-provided review
|
---|
| 50 | *
|
---|
| 51 | * @param string|null $lang Review language.
|
---|
| 52 | * @param string|null $type Type of text construct (typically text, html,
|
---|
| 53 | * or xhtml).
|
---|
| 54 | * @param string|null $value Text content of the review.
|
---|
| 55 | */
|
---|
| 56 | public function __construct($lang = null, $type = null, $value = null)
|
---|
| 57 | {
|
---|
| 58 | $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
---|
| 59 | parent::__construct();
|
---|
| 60 | $this->_lang = $lang;
|
---|
| 61 | $this->_type = $type;
|
---|
| 62 | $this->_text = $value;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * Retrieves DOMElement which corresponds to this element and all
|
---|
| 67 | * child properties. This is used to build this object back into a DOM
|
---|
| 68 | * and eventually XML text for sending to the server upon updates, or
|
---|
| 69 | * for application storage/persistance.
|
---|
| 70 | *
|
---|
| 71 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
| 72 | * @return DOMElement The DOMElement representing this element and all
|
---|
| 73 | * child properties.
|
---|
| 74 | */
|
---|
| 75 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 76 | {
|
---|
| 77 | $element = parent::getDOM($doc);
|
---|
| 78 | if ($this->_lang !== null) {
|
---|
| 79 | $element->setAttribute('lang', $this->_lang);
|
---|
| 80 | }
|
---|
| 81 | if ($this->_type !== null) {
|
---|
| 82 | $element->setAttribute('type', $this->_type);
|
---|
| 83 | }
|
---|
| 84 | return $element;
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | /**
|
---|
| 88 | * Extracts XML attributes from the DOM and converts them to the
|
---|
| 89 | * appropriate object members.
|
---|
| 90 | *
|
---|
| 91 | * @param DOMNode $attribute The DOMNode attribute to be handled.
|
---|
| 92 | */
|
---|
| 93 | protected function takeAttributeFromDOM($attribute)
|
---|
| 94 | {
|
---|
| 95 | switch ($attribute->localName) {
|
---|
| 96 | case 'lang':
|
---|
| 97 | $this->_lang = $attribute->nodeValue;
|
---|
| 98 | break;
|
---|
| 99 | case 'type':
|
---|
| 100 | $this->_type = $attribute->nodeValue;
|
---|
| 101 | break;
|
---|
| 102 | default:
|
---|
| 103 | parent::takeAttributeFromDOM($attribute);
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | /**
|
---|
| 108 | * Returns the language of link title
|
---|
| 109 | *
|
---|
| 110 | * @return string The lang
|
---|
| 111 | */
|
---|
| 112 | public function getLang()
|
---|
| 113 | {
|
---|
| 114 | return $this->_lang;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | /**
|
---|
| 118 | * Returns the type of text construct (typically 'text', 'html' or 'xhtml')
|
---|
| 119 | *
|
---|
| 120 | * @return string The type
|
---|
| 121 | */
|
---|
| 122 | public function getType()
|
---|
| 123 | {
|
---|
| 124 | return $this->_type;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | /**
|
---|
| 128 | * Sets the language of link title
|
---|
| 129 | *
|
---|
| 130 | * @param string $lang language of link title
|
---|
| 131 | * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
|
---|
| 132 | */
|
---|
| 133 | public function setLang($lang)
|
---|
| 134 | {
|
---|
| 135 | $this->_lang = $lang;
|
---|
| 136 | return $this;
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | /**
|
---|
| 140 | * Sets the type of text construct (typically 'text', 'html' or 'xhtml')
|
---|
| 141 | *
|
---|
| 142 | * @param string $type type of text construct (typically 'text', 'html' or 'xhtml')
|
---|
| 143 | * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
|
---|
| 144 | */
|
---|
| 145 | public function setType($type)
|
---|
| 146 | {
|
---|
| 147 | $this->_type = $type;
|
---|
| 148 | return $this;
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 |
|
---|
| 152 | }
|
---|
| 153 |
|
---|