web/lib/Zend/Gdata/App/Extension/Generator.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     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: Generator.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:generator 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_Generator extends Zend_Gdata_App_Extension
       
    39 {
       
    40 
       
    41     protected $_rootElement = 'generator';
       
    42     protected $_uri = null;
       
    43     protected $_version = null;
       
    44 
       
    45     public function __construct($text = null, $uri = null, $version = null)
       
    46     {
       
    47         parent::__construct();
       
    48         $this->_text = $text;
       
    49         $this->_uri = $uri;
       
    50         $this->_version = $version;
       
    51     }
       
    52 
       
    53     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
       
    54     {
       
    55         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
       
    56         if ($this->_uri !== null) {
       
    57             $element->setAttribute('uri', $this->_uri);
       
    58         }
       
    59         if ($this->_version !== null) {
       
    60             $element->setAttribute('version', $this->_version);
       
    61         }
       
    62         return $element;
       
    63     }
       
    64 
       
    65     protected function takeAttributeFromDOM($attribute)
       
    66     {
       
    67         switch ($attribute->localName) {
       
    68         case 'uri':
       
    69             $this->_uri = $attribute->nodeValue;
       
    70             break;
       
    71         case 'version':
       
    72             $this->_version= $attribute->nodeValue;
       
    73             break;
       
    74         default:
       
    75             parent::takeAttributeFromDOM($attribute);
       
    76         }
       
    77     }
       
    78 
       
    79     /**
       
    80      * @return Zend_Gdata_App_Extension_Uri
       
    81      */
       
    82     public function getUri()
       
    83     {
       
    84         return $this->_uri;
       
    85     }
       
    86 
       
    87     /**
       
    88      * @param Zend_Gdata_App_Extension_Uri $value
       
    89      * @return Zend_Gdata_App_Entry Provides a fluent interface
       
    90      */
       
    91     public function setUri($value)
       
    92     {
       
    93         $this->_uri = $value;
       
    94         return $this;
       
    95     }
       
    96 
       
    97     /**
       
    98      * @return Zend_Gdata_App_Extension_Version
       
    99      */
       
   100     public function getVersion()
       
   101     {
       
   102         return $this->_version;
       
   103     }
       
   104 
       
   105     /**
       
   106      * @param Zend_Gdata_App_Extension_Version $value
       
   107      * @return Zend_Gdata_App_Entry Provides a fluent interface
       
   108      */
       
   109     public function setVersion($value)
       
   110     {
       
   111         $this->_version = $value;
       
   112         return $this;
       
   113     }
       
   114 
       
   115 }