File indexing completed on 2024-12-29 05:27:41
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Gdata 0017 * @subpackage Analytics 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * @see Zend_Gdata_Extension 0025 */ 0026 // require_once 'Zend/Gdata/Extension.php'; 0027 0028 /** 0029 * @category Zend 0030 * @package Zend_Gdata 0031 * @subpackage Analytics 0032 */ 0033 class Zend_Gdata_Analytics_Extension_Property extends Zend_Gdata_Extension 0034 { 0035 protected $_rootNamespace = 'ga'; 0036 protected $_rootElement = 'property'; 0037 protected $_value = null; 0038 protected $_name = null; 0039 0040 /** 0041 * Constructs a new Zend_Gdata_Calendar_Extension_Timezone object. 0042 * @param string $value (optional) The text content of the element. 0043 */ 0044 public function __construct($value = null, $name = null) 0045 { 0046 $this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); 0047 parent::__construct(); 0048 $this->_value = $value; 0049 $this->_name = $name; 0050 } 0051 0052 /** 0053 * Given a DOMNode representing an attribute, tries to map the data into 0054 * instance members. If no mapping is defined, the name and value are 0055 * stored in an array. 0056 * 0057 * @param DOMNode $attribute The DOMNode attribute needed to be handled 0058 */ 0059 protected function takeAttributeFromDOM($attribute) 0060 { 0061 switch ($attribute->localName) { 0062 case 'name': 0063 $name = explode(':', $attribute->nodeValue); 0064 $this->_name = end($name); 0065 break; 0066 case 'value': 0067 $this->_value = $attribute->nodeValue; 0068 break; 0069 default: 0070 parent::takeAttributeFromDOM($attribute); 0071 } 0072 } 0073 0074 /** 0075 * Get the value for this element's value attribute. 0076 * 0077 * @return string The value associated with this attribute. 0078 */ 0079 public function getValue() 0080 { 0081 return $this->_value; 0082 } 0083 0084 /** 0085 * Set the value for this element's value attribute. 0086 * 0087 * @param string $value The desired value for this attribute. 0088 * @return Zend_Gdata_Analytics_Extension_Property The element being modified. 0089 */ 0090 public function setValue($value) 0091 { 0092 $this->_value = $value; 0093 return $this; 0094 } 0095 0096 /** 0097 * @param string $name 0098 * @return Zend_Gdata_Analytics_Extension_Property 0099 */ 0100 public function setName($name) 0101 { 0102 $this->_name = $name; 0103 return $this; 0104 } 0105 0106 /** 0107 * @return string 0108 */ 0109 public function getName() 0110 { 0111 return $this->_name; 0112 } 0113 0114 /** 0115 * Magic toString method allows using this directly via echo 0116 * Works best in PHP >= 4.2.0 0117 */ 0118 public function __toString() 0119 { 0120 return $this->getValue(); 0121 } 0122 }