source: extensions/Google2Piwigo/include/Zend/Gdata/Books/Extension/Review.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 4.3 KB
Line 
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-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: Review.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_Extension
26 */
27require_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-2012 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license    http://framework.zend.com/license/new-bsd     New BSD License
37 */
38class Zend_Gdata_Books_Extension_Review extends Zend_Gdata_Extension
39{
40
41    protected $_rootNamespace = 'gbs';
42    protected $_rootElement = 'review';
43    protected $_lang = null;
44    protected $_type = null;
45
46    /**
47     * Constructor for Zend_Gdata_Books_Extension_Review which
48     * User-provided review
49     *
50     * @param string|null $lang Review language.
51     * @param string|null $type Type of text construct (typically text, html,
52     *        or xhtml).
53     * @param string|null $value Text content of the review.
54     */
55    public function __construct($lang = null, $type = null, $value = null)
56    {
57        $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
58        parent::__construct();
59        $this->_lang = $lang;
60        $this->_type = $type;
61        $this->_text = $value;
62    }
63
64    /**
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.
69     *
70     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
71     * @return DOMElement The DOMElement representing this element and all
72     * child properties.
73     */
74    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
75    {
76        $element = parent::getDOM($doc);
77        if ($this->_lang !== null) {
78            $element->setAttribute('lang', $this->_lang);
79        }
80        if ($this->_type !== null) {
81            $element->setAttribute('type', $this->_type);
82        }
83        return $element;
84    }
85
86    /**
87     * Extracts XML attributes from the DOM and converts them to the
88     * appropriate object members.
89     *
90     * @param DOMNode $attribute The DOMNode attribute to be handled.
91     */
92    protected function takeAttributeFromDOM($attribute)
93    {
94        switch ($attribute->localName) {
95        case 'lang':
96            $this->_lang = $attribute->nodeValue;
97            break;
98        case 'type':
99            $this->_type = $attribute->nodeValue;
100            break;
101        default:
102            parent::takeAttributeFromDOM($attribute);
103        }
104    }
105
106    /**
107     * Returns the language of link title
108     *
109     * @return string The lang
110     */
111    public function getLang()
112    {
113        return $this->_lang;
114    }
115
116    /**
117     * Returns the type of text construct (typically 'text', 'html' or 'xhtml')
118     *
119     * @return string The type
120     */
121    public function getType()
122    {
123        return $this->_type;
124    }
125
126    /**
127     * Sets the language of link title
128     *
129     * @param string $lang language of link title
130     * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
131     */
132    public function setLang($lang)
133    {
134        $this->_lang = $lang;
135        return $this;
136    }
137
138    /**
139     * Sets the type of text construct (typically 'text', 'html' or 'xhtml')
140     *
141     * @param string $type type of text construct (typically 'text', 'html' or 'xhtml')
142     * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
143     */
144    public function setType($type)
145    {
146        $this->_type = $type;
147        return $this;
148    }
149
150
151}
152
Note: See TracBrowser for help on using the repository browser.