/wp-content/plugins/backwpup/sdk/WindowsAzure/ServiceBus/Models/SubscriptionInfo.php

https://bitbucket.org/cesarmedrano/cesarmedrano · PHP · 401 lines · 157 code · 32 blank · 212 comment · 4 complexity · 0da5faa76c92b9fd3a2246389abfca1a MD5 · raw file

  1. <?php
  2. /**
  3. * LICENSE: Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. *
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. * See the License for the specific language governing permissions and
  12. * limitations under the License.
  13. *
  14. * PHP version 5
  15. *
  16. * @category Microsoft
  17. * @package WindowsAzure\ServiceBus\Models
  18. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  19. * @copyright 2012 Microsoft Corporation
  20. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  21. * @link https://github.com/WindowsAzure/azure-sdk-for-php
  22. */
  23. namespace WindowsAzure\ServiceBus\Models;
  24. use WindowsAzure\Common\Internal\Atom\Entry;
  25. use WindowsAzure\Common\Internal\Atom\Content;
  26. use WindowsAzure\Common\Internal\Serialization\XmlSerializer;
  27. use WindowsAzure\Common\Internal\Resources;
  28. use WindowsAzure\Common\Internal\Utilities;
  29. use WindowsAzure\Common\Internal\Validate;
  30. use WindowsAzure\ServiceBus\Models\SubscriptionDescription;
  31. /**
  32. * The information of a subscription.
  33. *
  34. * @category Microsoft
  35. * @package WindowsAzure\ServiceBus\Models
  36. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  37. * @copyright 2012 Microsoft Corporation
  38. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  39. * @version Release: @package_version@
  40. * @link https://github.com/WindowsAzure/azure-sdk-for-php
  41. */
  42. class SubscriptionInfo extends Entry
  43. {
  44. /**
  45. * The entry of the subscription info.
  46. *
  47. * @var Entry
  48. */
  49. private $_entry;
  50. /**
  51. * The description of the subscription.
  52. *
  53. * @var SubscriptionDescription
  54. */
  55. private $_subscriptionDescription;
  56. /**
  57. * Creates a SubscriptionInfo instance with specified parameters.
  58. *
  59. * @param string $title The title of
  60. * the subscription.
  61. * @param SubscriptionDescription $subscriptionDescription The description
  62. * of the subscription.
  63. */
  64. public function __construct(
  65. $title = Resources::EMPTY_STRING,
  66. $subscriptionDescription = null
  67. ) {
  68. Validate::isString($title, 'title');
  69. if (is_null($subscriptionDescription)) {
  70. $subscriptionDescription = new SubscriptionDescription();
  71. }
  72. $this->_subscriptionDescription = $subscriptionDescription;
  73. $this->_entry = new Entry();
  74. $this->_entry->setTitle($title);
  75. $this->_entry->setAttribute(
  76. Resources::XMLNS,
  77. Resources::SERVICE_BUS_NAMESPACE
  78. );
  79. }
  80. /**
  81. * Populates the properties of the subscription info instance with a XML string.
  82. *
  83. * @param string $entryXml A XML string representing a subscription
  84. * information instance.
  85. *
  86. * @return none
  87. */
  88. public function parseXml($entryXml)
  89. {
  90. $this->_entry->parseXml($entryXml);
  91. $content = $this->_entry->getContent();
  92. if (is_null($content)) {
  93. $this->_subscriptionDescription = null;
  94. } else {
  95. $this->_subscriptionDescription = SubscriptionDescription::create(
  96. $content->getText()
  97. );
  98. }
  99. }
  100. /**
  101. * Writes XML based on the subscription information.
  102. *
  103. * @param XMLWriter $xmlWriter The XML writer.
  104. *
  105. * @return none
  106. */
  107. public function writeXml($xmlWriter)
  108. {
  109. $content = null;
  110. if (!is_null($this->_subscriptionDescription)) {
  111. $content = new Content();
  112. $content->setText(
  113. XmlSerializer::objectSerialize(
  114. $this->_subscriptionDescription,
  115. 'SubscriptionDescription'
  116. )
  117. );
  118. }
  119. $this->_entry->setContent($content);
  120. $this->_entry->writeXml($xmlWriter);
  121. }
  122. /**
  123. * Gets the entry of the subscription info.
  124. *
  125. * @return Entry
  126. */
  127. public function getEntry()
  128. {
  129. return $this->_entry;
  130. }
  131. /**
  132. * Sets the entry of the subscription info.
  133. *
  134. * @param Entry $entry The entry of the subscription info.
  135. *
  136. * @return none
  137. */
  138. public function setEntry($entry)
  139. {
  140. $this->_entry = $entry;
  141. }
  142. /**
  143. * Gets the title.
  144. *
  145. * @return string
  146. */
  147. public function getTitle()
  148. {
  149. return $this->_entry->getTitle();
  150. }
  151. /**
  152. * Sets the title.
  153. *
  154. * @param string $title The title of the queue info.
  155. *
  156. * @return none
  157. */
  158. public function setTitle($title)
  159. {
  160. $this->_entry->setTitle($title);
  161. }
  162. /**
  163. * Gets the subscription description.
  164. *
  165. * @return none
  166. */
  167. public function getSubscriptionDescription()
  168. {
  169. return $this->_subscriptionDescription;
  170. }
  171. /**
  172. * Sets the subscription description.
  173. *
  174. * @param string $subscriptionDescription The description of
  175. * the subscription.
  176. *
  177. * @return none
  178. */
  179. public function setSubscriptionDescription($subscriptionDescription)
  180. {
  181. $this->_subscriptionDescription = $subscriptionDescription;
  182. }
  183. /**
  184. * Gets the lock duration.
  185. *
  186. * @return integer
  187. */
  188. public function getLockDuration()
  189. {
  190. return $this->_subscriptionDescription->getLockDuration();
  191. }
  192. /**
  193. * Sets the lock duration.
  194. *
  195. * @param string $lockDuration The duration of the lock.
  196. *
  197. * @return none
  198. */
  199. public function setLockDuration($lockDuration)
  200. {
  201. $this->_subscriptionDescription->setlockDuration($lockDuration);
  202. }
  203. /**
  204. * Gets requires session.
  205. *
  206. * @return boolean
  207. */
  208. public function getRequiresSession()
  209. {
  210. return $this->_subscriptionDescription->getRequiresSession();
  211. }
  212. /**
  213. * Sets the requires session.
  214. *
  215. * @param boolean $requiresSession The requires session.
  216. *
  217. * @return none
  218. */
  219. public function setRequiresSession($requiresSession)
  220. {
  221. $this->_subscriptionDescription->setRequiresSession($requiresSession);
  222. }
  223. /**
  224. * Gets default message time to live.
  225. *
  226. * @return string
  227. */
  228. public function getDefaultMessageTimeToLive()
  229. {
  230. return $this->_subscriptionDescription->getDefaultMessageTimeToLive();
  231. }
  232. /**
  233. * Sets default message time to live.
  234. *
  235. * @param string $defaultMessageTimeToLive The default message time to live.
  236. *
  237. * @return none
  238. */
  239. public function setDefaultMessageTimeToLive($defaultMessageTimeToLive)
  240. {
  241. $this->_subscriptionDescription->setDefaultMessageTimeToLive($defaultMessageTimeToLive);
  242. }
  243. /**
  244. * Gets dead lettering on message expiration.
  245. *
  246. * @return string
  247. */
  248. public function getDeadLetteringOnMessageExpiration()
  249. {
  250. return $this->_subscriptionDescription->getDeadLetteringOnMessageExpiration();
  251. }
  252. /**
  253. * Sets dead lettering on message expiration.
  254. *
  255. * @param string $deadLetteringOnMessageExpiration The dead lettering
  256. * on message expiration.
  257. *
  258. * @return none
  259. */
  260. public function setDeadLetteringOnMessageExpiration(
  261. $deadLetteringOnMessageExpiration
  262. ) {
  263. $this->_subscriptionDescription->setDeadLetteringOnMessageExpiration($deadLetteringOnMessageExpiration);
  264. }
  265. /**
  266. * Gets dead lettering on filter evaluation exceptions.
  267. *
  268. * @return string
  269. */
  270. public function getDeadLetteringOnFilterEvaluationExceptions()
  271. {
  272. return $this->_subscriptionDescription->getDeadLetteringOnFilterEvaluationExceptions();
  273. }
  274. /**
  275. * Sets dead lettering on filter evaluation exceptions.
  276. *
  277. * @param string $deadLetteringOnFilterEvaluationExceptions Sets dead lettering
  278. * on filter evaluation exceptions.
  279. *
  280. * @return none
  281. */
  282. public function setDeadLetteringOnFilterEvaluationExceptions(
  283. $deadLetteringOnFilterEvaluationExceptions
  284. ) {
  285. $this->_subscriptionDescription->setdeadLetteringOnFilterEvaluationExceptions(
  286. $deadLetteringOnFilterEvaluationExceptions
  287. );
  288. }
  289. /**
  290. * Gets the default rule description.
  291. *
  292. * @return RuleDescription
  293. */
  294. public function getDefaultRuleDescription()
  295. {
  296. return $this->_subscriptionDescription->getDefaultRuleDescription();
  297. }
  298. /**
  299. * Sets the default rule description.
  300. *
  301. * @param string $defaultRuleDescription The default rule description.
  302. *
  303. * @return none
  304. */
  305. public function setDefaultRuleDescription($defaultRuleDescription)
  306. {
  307. $this->_subscriptionDescription->setDefaultRuleDescription($defaultRuleDescription);
  308. }
  309. /**
  310. * Gets the count of the message.
  311. *
  312. * @return integer
  313. */
  314. public function getMessageCount()
  315. {
  316. return $this->_subscriptionDescription->getMessageCount();
  317. }
  318. /**
  319. * Sets the count of the message.
  320. *
  321. * @param string $messageCount The count of the message.
  322. *
  323. * @return none
  324. */
  325. public function setMessageCount($messageCount)
  326. {
  327. $this->_subscriptionDescription->setMessageCount($messageCount);
  328. }
  329. /**
  330. * Gets maximum delivery count.
  331. *
  332. * @return integer
  333. */
  334. public function getMaxDeliveryCount()
  335. {
  336. return $this->_subscriptionDescription->getMaxDeliveryCount();
  337. }
  338. /**
  339. * Sets maximum delivery count.
  340. *
  341. * @param integer $maxDeliveryCount The maximum delivery count.
  342. *
  343. * @return none
  344. */
  345. public function setMaxDeliveryCount($maxDeliveryCount)
  346. {
  347. $this->_subscriptionDescription->setmaxDeliveryCount($maxDeliveryCount);
  348. }
  349. /**
  350. * Gets enable batched operations.
  351. *
  352. * @return boolean
  353. */
  354. public function getEnableBatchedOperations()
  355. {
  356. return $this->_subscriptionDescription->getEnableBatchedOperations();
  357. }
  358. /**
  359. * Sets enable batched operations.
  360. *
  361. * @param boolean $enableBatchedOperations Enable batched operations.
  362. *
  363. * @return none
  364. */
  365. public function setEnableBatchedOperations($enableBatchedOperations)
  366. {
  367. $this->_subscriptionDescription->setEnableBatchedOperations($enableBatchedOperations);
  368. }
  369. }