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

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 Gdata
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_Extension
0026  */
0027 // require_once 'Zend/Gdata/Extension.php';
0028 
0029 /**
0030  * Data model for gd:extendedProperty element, used by some Gdata
0031  * services to implement arbitrary name/value pair storage
0032  *
0033  * @category   Zend
0034  * @package    Zend_Gdata
0035  * @subpackage Gdata
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  */
0039 class Zend_Gdata_Extension_ExtendedProperty extends Zend_Gdata_Extension
0040 {
0041 
0042     protected $_rootElement = 'extendedProperty';
0043     protected $_name = null;
0044     protected $_value = null;
0045 
0046     public function __construct($name = null, $value = null)
0047     {
0048         parent::__construct();
0049         $this->_name = $name;
0050         $this->_value = $value;
0051     }
0052 
0053     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0054     {
0055         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0056         if ($this->_name !== null) {
0057             $element->setAttribute('name', $this->_name);
0058         }
0059         if ($this->_value !== null) {
0060             $element->setAttribute('value', $this->_value);
0061         }
0062         return $element;
0063     }
0064 
0065     protected function takeAttributeFromDOM($attribute)
0066     {
0067         switch ($attribute->localName) {
0068         case 'name':
0069             $this->_name = $attribute->nodeValue;
0070             break;
0071         case 'value':
0072             $this->_value = $attribute->nodeValue;
0073             break;
0074         default:
0075             parent::takeAttributeFromDOM($attribute);
0076         }
0077     }
0078 
0079     public function __toString()
0080     {
0081         return $this->getName() . '=' . $this->getValue();
0082     }
0083 
0084     public function getName()
0085     {
0086         return $this->_name;
0087     }
0088 
0089     public function setName($value)
0090     {
0091         $this->_name = $value;
0092         return $this;
0093     }
0094 
0095     public function getValue()
0096     {
0097         return $this->_value;
0098     }
0099 
0100     public function setValue($value)
0101     {
0102         $this->_value = $value;
0103         return $this;
0104     }
0105 
0106 }