Generator.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 App
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * @see Zend_Gdata_App_Extension
  23. */
  24. require_once 'Zend/Gdata/App/Extension.php';
  25. /**
  26. * Represents the atom:generator element
  27. *
  28. * @category Zend
  29. * @package Zend_Gdata
  30. * @subpackage App
  31. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Gdata_App_Extension_Generator extends Zend_Gdata_App_Extension
  35. {
  36. protected $_rootElement = 'generator';
  37. protected $_uri = null;
  38. protected $_version = null;
  39. public function __construct($text = null, $uri = null, $version = null)
  40. {
  41. parent::__construct();
  42. $this->_text = $text;
  43. $this->_uri = $uri;
  44. $this->_version = $version;
  45. }
  46. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  47. {
  48. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  49. if ($this->_uri !== null) {
  50. $element->setAttribute('uri', $this->_uri);
  51. }
  52. if ($this->_version !== null) {
  53. $element->setAttribute('version', $this->_version);
  54. }
  55. return $element;
  56. }
  57. protected function takeAttributeFromDOM($attribute)
  58. {
  59. switch ($attribute->localName) {
  60. case 'uri':
  61. $this->_uri = $attribute->nodeValue;
  62. break;
  63. case 'version':
  64. $this->_version= $attribute->nodeValue;
  65. break;
  66. default:
  67. parent::takeAttributeFromDOM($attribute);
  68. }
  69. }
  70. /**
  71. * @return Zend_Gdata_App_Extension_Uri
  72. */
  73. public function getUri()
  74. {
  75. return $this->_uri;
  76. }
  77. /**
  78. * @param Zend_Gdata_App_Extension_Uri $value
  79. * @return Zend_Gdata_App_Entry Provides a fluent interface
  80. */
  81. public function setUri($value)
  82. {
  83. $this->_uri = $value;
  84. return $this;
  85. }
  86. /**
  87. * @return Zend_Gdata_App_Extension_Version
  88. */
  89. public function getVersion()
  90. {
  91. return $this->_version;
  92. }
  93. /**
  94. * @param Zend_Gdata_App_Extension_Version $value
  95. * @return Zend_Gdata_App_Entry Provides a fluent interface
  96. */
  97. public function setVersion($value)
  98. {
  99. $this->_version = $value;
  100. return $this;
  101. }
  102. }