TableId.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage Analytics
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Gdata_Extension
  24. */
  25. require_once 'Zend/Gdata/Extension.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Gdata
  29. * @subpackage Analytics
  30. */
  31. class Zend_Gdata_Analytics_Extension_TableId extends Zend_Gdata_Extension
  32. {
  33. protected $_rootNamespace = 'ga';
  34. protected $_rootElement = 'tableId';
  35. protected $_value = null;
  36. /**
  37. * Constructs a new Zend_Gdata_Calendar_Extension_Timezone object.
  38. * @param string $value (optional) The text content of the element.
  39. */
  40. public function __construct($value = null)
  41. {
  42. $this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
  43. parent::__construct();
  44. $this->_value = $value;
  45. }
  46. /**
  47. * Retrieves a DOMElement which corresponds to this element and all
  48. * child properties. This is used to build an entry back into a DOM
  49. * and eventually XML text for sending to the server upon updates, or
  50. * for application storage/persistence.
  51. *
  52. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  53. * @return DOMElement The DOMElement representing this element and all
  54. * child properties.
  55. */
  56. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  57. {
  58. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  59. if ($this->_value != null) {
  60. $element->setAttribute('value', $this->_value);
  61. }
  62. return $element;
  63. }
  64. /**
  65. * Given a DOMNode representing an attribute, tries to map the data into
  66. * instance members. If no mapping is defined, the name and value are
  67. * stored in an array.
  68. *
  69. * @param DOMNode $attribute The DOMNode attribute needed to be handled
  70. */
  71. protected function takeChildFromDOM($child)
  72. {
  73. $this->_value = $child->nodeValue;
  74. }
  75. /**
  76. * Get the value for this element's value attribute.
  77. *
  78. * @return string The value associated with this attribute.
  79. */
  80. public function getValue()
  81. {
  82. return $this->_value;
  83. }
  84. /**
  85. * Set the value for this element's value attribute.
  86. *
  87. * @param string $value The desired value for this attribute.
  88. * @return Zend_Gdata_Calendar_Extension_Timezone The element being modified.
  89. */
  90. public function setValue($value)
  91. {
  92. $this->_value = $value;
  93. return $this;
  94. }
  95. /**
  96. * Magic toString method allows using this directly via echo
  97. * Works best in PHP >= 4.2.0
  98. */
  99. public function __toString()
  100. {
  101. return $this->getValue();
  102. }
  103. }