PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/magento/zendframework1/library/Zend/Gdata/Media/Extension/MediaText.php

https://gitlab.com/yousafsyed/easternglamor
PHP | 211 lines | 93 code | 19 blank | 99 comment | 5 complexity | 557defecdbd618e8917ed5fcd6ccddbf MD5 | raw file
  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 Media
  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 media:text element
  28. *
  29. * @category Zend
  30. * @package Zend_Gdata
  31. * @subpackage Media
  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_Media_Extension_MediaText extends Zend_Gdata_Extension
  36. {
  37. protected $_rootElement = 'text';
  38. protected $_rootNamespace = 'media';
  39. /**
  40. * @var string
  41. */
  42. protected $_type = null;
  43. /**
  44. * @var string
  45. */
  46. protected $_lang = null;
  47. /**
  48. * @var string
  49. */
  50. protected $_start = null;
  51. /**
  52. * @var string
  53. */
  54. protected $_end = null;
  55. /**
  56. * Constructs a new MediaText element
  57. *
  58. * @param string $text
  59. * @param string $type
  60. * @param string $lang
  61. * @param string $start
  62. * @param string $end
  63. */
  64. public function __construct($text = null, $type = null, $lang = null,
  65. $start = null, $end = null)
  66. {
  67. $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
  68. parent::__construct();
  69. $this->_text = $text;
  70. $this->_type = $type;
  71. $this->_lang = $lang;
  72. $this->_start = $start;
  73. $this->_end = $end;
  74. }
  75. /**
  76. * Retrieves a DOMElement which corresponds to this element and all
  77. * child properties. This is used to build an entry back into a DOM
  78. * and eventually XML text for sending to the server upon updates, or
  79. * for application storage/persistence.
  80. *
  81. * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  82. * @return DOMElement The DOMElement representing this element and all
  83. * child properties.
  84. */
  85. public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
  86. {
  87. $element = parent::getDOM($doc, $majorVersion, $minorVersion);
  88. if ($this->_type !== null) {
  89. $element->setAttribute('type', $this->_type);
  90. }
  91. if ($this->_lang !== null) {
  92. $element->setAttribute('lang', $this->_lang);
  93. }
  94. if ($this->_start !== null) {
  95. $element->setAttribute('start', $this->_start);
  96. }
  97. if ($this->_end !== null) {
  98. $element->setAttribute('end', $this->_end);
  99. }
  100. return $element;
  101. }
  102. /**
  103. * Given a DOMNode representing an attribute, tries to map the data into
  104. * instance members. If no mapping is defined, the name and value are
  105. * stored in an array.
  106. *
  107. * @param DOMNode $attribute The DOMNode attribute needed to be handled
  108. */
  109. protected function takeAttributeFromDOM($attribute)
  110. {
  111. switch ($attribute->localName) {
  112. case 'type':
  113. $this->_type = $attribute->nodeValue;
  114. break;
  115. case 'lang':
  116. $this->_lang = $attribute->nodeValue;
  117. break;
  118. case 'start':
  119. $this->_start = $attribute->nodeValue;
  120. break;
  121. case 'end':
  122. $this->_end = $attribute->nodeValue;
  123. break;
  124. default:
  125. parent::takeAttributeFromDOM($attribute);
  126. }
  127. }
  128. /**
  129. * @return string
  130. */
  131. public function getType()
  132. {
  133. return $this->_type;
  134. }
  135. /**
  136. * @param string $value
  137. * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
  138. */
  139. public function setType($value)
  140. {
  141. $this->_type = $value;
  142. return $this;
  143. }
  144. /**
  145. * @return string
  146. */
  147. public function getLang()
  148. {
  149. return $this->_lang;
  150. }
  151. /**
  152. * @param string $value
  153. * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
  154. */
  155. public function setLang($value)
  156. {
  157. $this->_lang = $value;
  158. return $this;
  159. }
  160. /**
  161. * @return string
  162. */
  163. public function getStart()
  164. {
  165. return $this->_start;
  166. }
  167. /**
  168. * @param string $value
  169. * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
  170. */
  171. public function setStart($value)
  172. {
  173. $this->_start = $value;
  174. return $this;
  175. }
  176. /**
  177. * @return string
  178. */
  179. public function getEnd()
  180. {
  181. return $this->_end;
  182. }
  183. /**
  184. * @param string $value
  185. * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface
  186. */
  187. public function setEnd($value)
  188. {
  189. $this->_end = $value;
  190. return $this;
  191. }
  192. }