PageRenderTime 467ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/cesarmedrano/cesarmedrano
PHP | 413 lines | 172 code | 42 blank | 199 comment | 9 complexity | 18810f5954007286fa77e03788034503 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\Resources;
  25. use WindowsAzure\Common\Internal\Utilities;
  26. /**
  27. * The subscription description.
  28. *
  29. * @category Microsoft
  30. * @package WindowsAzure\ServiceBus\Models
  31. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  32. * @copyright 2012 Microsoft Corporation
  33. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  34. * @version Release: @package_version@
  35. * @link https://github.com/WindowsAzure/azure-sdk-for-php
  36. */
  37. class SubscriptionDescription
  38. {
  39. /**
  40. * The duration of the lock.
  41. *
  42. * @var string
  43. */
  44. private $_lockDuration;
  45. /**
  46. * Requires session.
  47. *
  48. * @var boolean
  49. */
  50. private $_requiresSession;
  51. /**
  52. * The default message time to live.
  53. *
  54. * @var string
  55. */
  56. private $_defaultMessageTimeToLive;
  57. /**
  58. * The dead lettering on message expiration.
  59. *
  60. * @var string
  61. */
  62. private $_deadLetteringOnMessageExpiration;
  63. /**
  64. * The dead lettering on filter evaluation exception.
  65. *
  66. * @var string
  67. */
  68. private $_deadLetteringOnFilterEvaluationExceptions;
  69. /**
  70. * The description of the default rule.
  71. *
  72. * @var string
  73. */
  74. private $_defaultRuleDescription;
  75. /**
  76. * The count of the message.
  77. *
  78. * @var integer
  79. */
  80. private $_messageCount;
  81. /**
  82. * The count of the delivery
  83. *
  84. * @var integer
  85. */
  86. private $_maxDeliveryCount;
  87. /**
  88. * Enables Batched operations.
  89. *
  90. * @var boolean
  91. */
  92. private $_enableBatchedOperations;
  93. /**
  94. * Creates a subscription description instance with default
  95. * parameter.
  96. */
  97. public function __construct()
  98. {
  99. }
  100. /**
  101. * Creates a subscription description with specified XML string.
  102. *
  103. * @param string $subscriptionDescriptionXml An XML based subscription
  104. * description.
  105. *
  106. * @return none
  107. */
  108. public static function create($subscriptionDescriptionXml)
  109. {
  110. $subscriptionDescription = new SubscriptionDescription();
  111. $root = simplexml_load_string(
  112. $subscriptionDescriptionXml
  113. );
  114. $subscriptionDescriptionArray = (array)$root;
  115. if (array_key_exists('LockDuration', $subscriptionDescriptionArray)) {
  116. $subscriptionDescription->setLockDuration(
  117. (string)$subscriptionDescriptionArray['LockDuration']
  118. );
  119. }
  120. if (array_key_exists('RequiresSession', $subscriptionDescriptionArray)) {
  121. $subscriptionDescription->setRequiresSession(
  122. (boolean)$subscriptionDescriptionArray['RequiresSession']
  123. );
  124. }
  125. if (array_key_exists(
  126. 'DefaultMessageTimeToLive',
  127. $subscriptionDescriptionArray
  128. )
  129. ) {
  130. $subscriptionDescription->setDefaultMessageTimeToLive(
  131. (string)$subscriptionDescriptionArray['DefaultMessageTimeToLive']
  132. );
  133. }
  134. if (array_key_exists(
  135. 'DeadLetteringOnMessageExpiration',
  136. $subscriptionDescriptionArray
  137. )
  138. ) {
  139. $subscriptionDescription->setDeadLetteringOnMessageExpiration(
  140. (string)$subscriptionDescriptionArray[
  141. 'DeadLetteringOnMessageExpiration'
  142. ]
  143. );
  144. }
  145. if (array_key_exists(
  146. 'DeadLetteringOnFilterEvaluationException',
  147. $subscriptionDescriptionArray
  148. )
  149. ) {
  150. $subscriptionDescription->setDeadLetteringOnFilterEvaluationException(
  151. (string)$subscriptionDescriptionArray[
  152. 'DeadLetteringOnFilterEvaluationException'
  153. ]
  154. );
  155. }
  156. if (array_key_exists(
  157. 'DefaultRuleDescription',
  158. $subscriptionDescriptionArray
  159. )
  160. ) {
  161. $subscriptionDescription->setDefaultRuleDescription(
  162. (string)$subscriptionDescriptionArray['DefaultRuleDescription']
  163. );
  164. }
  165. if (array_key_exists('MessageCount', $subscriptionDescriptionArray)) {
  166. $subscriptionDescription->setMessageCount(
  167. (string)$subscriptionDescriptionArray['MessageCount']
  168. );
  169. }
  170. if (array_key_exists('MaxDeliveryCount', $subscriptionDescriptionArray)) {
  171. $subscriptionDescription->setMaxDeliveryCount(
  172. (string)$subscriptionDescriptionArray['MaxDeliveryCount']
  173. );
  174. }
  175. if (array_key_exists(
  176. 'EnableBatchedOperations',
  177. $subscriptionDescriptionArray
  178. )
  179. ) {
  180. $subscriptionDescription->setEnableBatchedOperations(
  181. (boolean)$subscriptionDescriptionArray['EnableBatchedOperations']
  182. );
  183. }
  184. return $subscriptionDescription;
  185. }
  186. /**
  187. * Gets the lock duration.
  188. *
  189. * @return integer
  190. */
  191. public function getLockDuration()
  192. {
  193. return $this->_lockDuration;
  194. }
  195. /**
  196. * Sets the lock duration.
  197. *
  198. * @param string $lockDuration The duration of the lock.
  199. *
  200. * @return none
  201. */
  202. public function setLockDuration($lockDuration)
  203. {
  204. $this->_lockDuration = $lockDuration;
  205. }
  206. /**
  207. * Gets requires session.
  208. *
  209. * @return boolean
  210. */
  211. public function getRequiresSession()
  212. {
  213. return $this->_requiresSession;
  214. }
  215. /**
  216. * Sets the requires session.
  217. *
  218. * @param boolean $requiresSession The requires session.
  219. *
  220. * @return none
  221. */
  222. public function setRequiresSession($requiresSession)
  223. {
  224. $this->_requiresSession = $requiresSession;
  225. }
  226. /**
  227. * Gets default message time to live.
  228. *
  229. * @return string
  230. */
  231. public function getDefaultMessageTimeToLive()
  232. {
  233. return $this->_defaultMessageTimeToLive;
  234. }
  235. /**
  236. * Sets default message time to live.
  237. *
  238. * @param string $defaultMessageTimeToLive The default message time to live.
  239. *
  240. * @return none
  241. */
  242. public function setDefaultMessageTimeToLive($defaultMessageTimeToLive)
  243. {
  244. $this->_defaultMessageTimeToLive = $defaultMessageTimeToLive;
  245. }
  246. /**
  247. * Gets dead lettering on message expiration.
  248. *
  249. * @return string
  250. */
  251. public function getDeadLetteringOnMessageExpiration()
  252. {
  253. return $this->_deadLetteringOnMessageExpiration;
  254. }
  255. /**
  256. * Sets dead lettering on message expiration.
  257. *
  258. * @param string $deadLetteringOnMessageExpiration The dead lettering
  259. * on message expiration.
  260. *
  261. * @return none
  262. */
  263. public function setDeadLetteringOnMessageExpiration(
  264. $deadLetteringOnMessageExpiration
  265. ) {
  266. $this->_deadLetteringOnMessageExpiration = $deadLetteringOnMessageExpiration;
  267. }
  268. /**
  269. * Gets dead lettering on filter evaluation exceptions.
  270. *
  271. * @return string
  272. */
  273. public function getDeadLetteringOnFilterEvaluationExceptions()
  274. {
  275. return $this->_deadLetteringOnFilterEvaluationExceptions;
  276. }
  277. /**
  278. * Sets dead lettering on filter evaluation exceptions.
  279. *
  280. * @param string $deadLetteringOnFilterEvaluationExceptions Sets dead lettering
  281. * on filter evaluation exceptions.
  282. *
  283. * @return none
  284. */
  285. public function setDeadLetteringOnFilterEvaluationExceptions(
  286. $deadLetteringOnFilterEvaluationExceptions
  287. ) {
  288. $this->_deadLetteringOnFilterEvaluationExceptions
  289. = $deadLetteringOnFilterEvaluationExceptions;
  290. }
  291. /**
  292. * Gets the default rule description.
  293. *
  294. * @return RuleDescription
  295. */
  296. public function getDefaultRuleDescription()
  297. {
  298. return $this->_defaultRuleDescription;
  299. }
  300. /**
  301. * Sets the default rule description.
  302. *
  303. * @param string $defaultRuleDescription The default rule description.
  304. *
  305. * @return none
  306. */
  307. public function setDefaultRuleDescription($defaultRuleDescription)
  308. {
  309. $this->_defaultRuleDescription = $defaultRuleDescription;
  310. }
  311. /**
  312. * Gets the count of the message.
  313. *
  314. * @return integer
  315. */
  316. public function getMessageCount()
  317. {
  318. return $this->_messageCount;
  319. }
  320. /**
  321. * Sets the count of the message.
  322. *
  323. * @param string $messageCount The count of the message.
  324. *
  325. * @return none
  326. */
  327. public function setMessageCount($messageCount)
  328. {
  329. $this->_messageCount = $messageCount;
  330. }
  331. /**
  332. * Gets maximum delivery count.
  333. *
  334. * @return integer
  335. */
  336. public function getMaxDeliveryCount()
  337. {
  338. return $this->_maxDeliveryCount;
  339. }
  340. /**
  341. * Sets maximum delivery count.
  342. *
  343. * @param integer $maxDeliveryCount The maximum delivery count.
  344. *
  345. * @return none
  346. */
  347. public function setMaxDeliveryCount($maxDeliveryCount)
  348. {
  349. $this->_maxDeliveryCount = $maxDeliveryCount;
  350. }
  351. /**
  352. * Gets enable batched operations.
  353. *
  354. * @return boolean
  355. */
  356. public function getEnableBatchedOperations()
  357. {
  358. return $this->_enableBatchedOperations;
  359. }
  360. /**
  361. * Sets enable batched operations.
  362. *
  363. * @param boolean $enableBatchedOperations Enable batched operations.
  364. *
  365. * @return none
  366. */
  367. public function setEnableBatchedOperations($enableBatchedOperations)
  368. {
  369. $this->_enableBatchedOperations = $enableBatchedOperations;
  370. }
  371. }