File indexing completed on 2025-03-02 05:29:25

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage App
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_App_Extension
0026  */
0027 // require_once 'Zend/Gdata/App/Extension.php';
0028 
0029 /**
0030  * Represents the atom:category element
0031  *
0032  * @category   Zend
0033  * @package    Zend_Gdata
0034  * @subpackage App
0035  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0036  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0037  */
0038 class Zend_Gdata_App_Extension_Category extends Zend_Gdata_App_Extension
0039 {
0040 
0041     protected $_rootElement = 'category';
0042     protected $_term = null;
0043     protected $_scheme = null;
0044     protected $_label = null;
0045 
0046     public function __construct($term = null, $scheme = null, $label=null)
0047     {
0048         parent::__construct();
0049         $this->_term = $term;
0050         $this->_scheme = $scheme;
0051         $this->_label = $label;
0052     }
0053 
0054     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0055     {
0056         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0057         if ($this->_term !== null) {
0058             $element->setAttribute('term', $this->_term);
0059         }
0060         if ($this->_scheme !== null) {
0061             $element->setAttribute('scheme', $this->_scheme);
0062         }
0063         if ($this->_label !== null) {
0064             $element->setAttribute('label', $this->_label);
0065         }
0066         return $element;
0067     }
0068 
0069     protected function takeAttributeFromDOM($attribute)
0070     {
0071         switch ($attribute->localName) {
0072         case 'term':
0073             $this->_term = $attribute->nodeValue;
0074             break;
0075         case 'scheme':
0076             $this->_scheme = $attribute->nodeValue;
0077             break;
0078         case 'label':
0079             $this->_label = $attribute->nodeValue;
0080             break;
0081         default:
0082             parent::takeAttributeFromDOM($attribute);
0083         }
0084     }
0085 
0086     /**
0087      * @return string|null
0088      */
0089     public function getTerm()
0090     {
0091         return $this->_term;
0092     }
0093 
0094     /**
0095      * @param string|null $value
0096      * @return Zend_Gdata_App_Extension_Category Provides a fluent interface
0097      */
0098     public function setTerm($value)
0099     {
0100         $this->_term = $value;
0101         return $this;
0102     }
0103 
0104     /**
0105      * @return string|null
0106      */
0107     public function getScheme()
0108     {
0109         return $this->_scheme;
0110     }
0111 
0112     /**
0113      * @param string|null $value
0114      * @return Zend_Gdata_App_Extension_Category Provides a fluent interface
0115      */
0116     public function setScheme($value)
0117     {
0118         $this->_scheme = $value;
0119         return $this;
0120     }
0121 
0122     /**
0123      * @return string|null
0124      */
0125     public function getLabel()
0126     {
0127         return $this->_label;
0128     }
0129 
0130     /**
0131      * @param string|null $value
0132      * @return Zend_Gdata_App_Extension_Category Provides a fluent interface
0133      */
0134     public function setLabel($value)
0135     {
0136         $this->_label = $value;
0137         return $this;
0138     }
0139 
0140 }