[ZF-10089] Zend_Log
[zend/radio.git] / library / Zend / Gdata / Books / Extension / Viewability.php
blobd37e9a73b882607d731766cf19aaeaf049546515
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
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.
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Books
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
21 * @version $Id$
24 /**
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
29 /**
30 * Describes a viewability
32 * @category Zend
33 * @package Zend_Gdata
34 * @subpackage Books
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_Viewability extends Zend_Gdata_Extension
41 protected $_rootNamespace = 'gbs';
42 protected $_rootElement = 'viewability';
43 protected $_value = null;
45 /**
46 * Constructor for Zend_Gdata_Books_Extension_Viewability which
47 * Describes a viewability
49 * @param string|null $value A programmatic value representing the book's
50 * viewability mode.
52 public function __construct($value = null)
54 $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
55 parent::__construct();
56 $this->_value = $value;
59 /**
60 * Retrieves DOMElement which corresponds to this element and all
61 * child properties. This is used to build this object back into a DOM
62 * and eventually XML text for sending to the server upon updates, or
63 * for application storage/persistance.
65 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
66 * @return DOMElement The DOMElement representing this element and all
67 * child properties.
69 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
71 $element = parent::getDOM($doc);
72 if ($this->_value !== null) {
73 $element->setAttribute('value', $this->_value);
75 return $element;
78 /**
79 * Extracts XML attributes from the DOM and converts them to the
80 * appropriate object members.
82 * @param DOMNode $attribute The DOMNode attribute to be handled.
84 protected function takeAttributeFromDOM($attribute)
86 switch ($attribute->localName) {
87 case 'value':
88 $this->_value = $attribute->nodeValue;
89 break;
90 default:
91 parent::takeAttributeFromDOM($attribute);
95 /**
96 * Returns the programmatic value that describes the viewability of a volume
97 * in Google Book Search
99 * @return string The value
101 public function getValue()
103 return $this->_value;
107 * Sets the programmatic value that describes the viewability of a volume in
108 * Google Book Search
110 * @param string $value programmatic value that describes the viewability
111 * of a volume in Googl eBook Search
112 * @return Zend_Gdata_Books_Extension_Viewability Provides a fluent
113 * interface
115 public function setValue($value)
117 $this->_value = $value;
118 return $this;