[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 App
|
---|
| 19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @see Zend_Gdata_App_Extension
|
---|
| 25 | */
|
---|
| 26 | require_once 'Zend/Gdata/App/Extension.php';
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * Represents the atom:category element
|
---|
| 30 | *
|
---|
| 31 | * @category Zend
|
---|
| 32 | * @package Zend_Gdata
|
---|
| 33 | * @subpackage App
|
---|
| 34 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 35 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 36 | */
|
---|
| 37 | class Zend_Gdata_App_Extension_Category extends Zend_Gdata_App_Extension
|
---|
| 38 | {
|
---|
| 39 |
|
---|
| 40 | protected $_rootElement = 'category';
|
---|
| 41 | protected $_term = null;
|
---|
| 42 | protected $_scheme = null;
|
---|
| 43 | protected $_label = null;
|
---|
| 44 |
|
---|
| 45 | public function __construct($term = null, $scheme = null, $label=null)
|
---|
| 46 | {
|
---|
| 47 | parent::__construct();
|
---|
| 48 | $this->_term = $term;
|
---|
| 49 | $this->_scheme = $scheme;
|
---|
| 50 | $this->_label = $label;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 54 | {
|
---|
| 55 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 56 | if ($this->_term !== null) {
|
---|
| 57 | $element->setAttribute('term', $this->_term);
|
---|
| 58 | }
|
---|
| 59 | if ($this->_scheme !== null) {
|
---|
| 60 | $element->setAttribute('scheme', $this->_scheme);
|
---|
| 61 | }
|
---|
| 62 | if ($this->_label !== null) {
|
---|
| 63 | $element->setAttribute('label', $this->_label);
|
---|
| 64 | }
|
---|
| 65 | return $element;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | protected function takeAttributeFromDOM($attribute)
|
---|
| 69 | {
|
---|
| 70 | switch ($attribute->localName) {
|
---|
| 71 | case 'term':
|
---|
| 72 | $this->_term = $attribute->nodeValue;
|
---|
| 73 | break;
|
---|
| 74 | case 'scheme':
|
---|
| 75 | $this->_scheme = $attribute->nodeValue;
|
---|
| 76 | break;
|
---|
| 77 | case 'label':
|
---|
| 78 | $this->_label = $attribute->nodeValue;
|
---|
| 79 | break;
|
---|
| 80 | default:
|
---|
| 81 | parent::takeAttributeFromDOM($attribute);
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | /**
|
---|
| 86 | * @return string|null
|
---|
| 87 | */
|
---|
| 88 | public function getTerm()
|
---|
| 89 | {
|
---|
| 90 | return $this->_term;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | /**
|
---|
| 94 | * @param string|null $value
|
---|
| 95 | * @return Zend_Gdata_App_Extension_Category Provides a fluent interface
|
---|
| 96 | */
|
---|
| 97 | public function setTerm($value)
|
---|
| 98 | {
|
---|
| 99 | $this->_term = $value;
|
---|
| 100 | return $this;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | /**
|
---|
| 104 | * @return string|null
|
---|
| 105 | */
|
---|
| 106 | public function getScheme()
|
---|
| 107 | {
|
---|
| 108 | return $this->_scheme;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | /**
|
---|
| 112 | * @param string|null $value
|
---|
| 113 | * @return Zend_Gdata_App_Extension_Category Provides a fluent interface
|
---|
| 114 | */
|
---|
| 115 | public function setScheme($value)
|
---|
| 116 | {
|
---|
| 117 | $this->_scheme = $value;
|
---|
| 118 | return $this;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | /**
|
---|
| 122 | * @return string|null
|
---|
| 123 | */
|
---|
| 124 | public function getLabel()
|
---|
| 125 | {
|
---|
| 126 | return $this->_label;
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | /**
|
---|
| 130 | * @param string|null $value
|
---|
| 131 | * @return Zend_Gdata_App_Extension_Category Provides a fluent interface
|
---|
| 132 | */
|
---|
| 133 | public function setLabel($value)
|
---|
| 134 | {
|
---|
| 135 | $this->_label = $value;
|
---|
| 136 | return $this;
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | }
|
---|