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