Generator.php 2.9 KB

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