PageRenderTime 53ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/codes-php/phpjakarta/WindowsAzure/Queue/Models/ListQueuesResult.php

http://bukuphpjs.codeplex.com
PHP | 202 lines | 84 code | 19 blank | 99 comment | 1 complexity | 61e229f86938476e1a9e71f9c156d5b4 MD5 | raw file
Possible License(s): Apache-2.0, MIT, LGPL-2.1
  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\Queue\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\Queue\Models;
  24. use WindowsAzure\Common\Internal\Resources;
  25. use WindowsAzure\Queue\Models\Queue;
  26. use WindowsAzure\Common\Internal\Utilities;
  27. /**
  28. * Container to hold list queue response object.
  29. *
  30. * @category Microsoft
  31. * @package WindowsAzure\Queue\Models
  32. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  33. * @copyright 2012 Microsoft Corporation
  34. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  35. * @version Release: @package_version@
  36. * @link https://github.com/windowsazure/azure-sdk-for-php
  37. */
  38. class ListQueuesResult
  39. {
  40. private $_queues;
  41. private $_prefix;
  42. private $_marker;
  43. private $_nextMarker;
  44. private $_maxResults;
  45. /**
  46. * Creates ListQueuesResult object from parsed XML response.
  47. *
  48. * @param array $parsedResponse XML response parsed into array.
  49. *
  50. * @return WindowsAzure\Queue\Models\ListQueuesResult.
  51. */
  52. public static function create($parsedResponse)
  53. {
  54. $result = new ListQueuesResult();
  55. $result->_prefix = Utilities::tryGetValue(
  56. $parsedResponse, Resources::QP_PREFIX
  57. );
  58. $result->_marker = Utilities::tryGetValue(
  59. $parsedResponse, Resources::QP_MARKER
  60. );
  61. $result->_nextMarker = Utilities::tryGetValue(
  62. $parsedResponse, Resources::QP_NEXT_MARKER
  63. );
  64. $result->_maxResults = Utilities::tryGetValue(
  65. $parsedResponse, Resources::QP_MAX_RESULTS
  66. );
  67. $result->_queues = array();
  68. $rawQueues = array();
  69. if ( !empty($parsedResponse['Queues']) ) {
  70. $rawQueues = Utilities::getArray($parsedResponse['Queues']['Queue']);
  71. }
  72. foreach ($rawQueues as $value) {
  73. $queue = new Queue($value['Name'], $value['Url']);
  74. $metadata = Utilities::tryGetValue($value, Resources::QP_METADATA);
  75. $queue->setMetadata(is_null($metadata) ? array() : $metadata);
  76. $result->_queues[] = $queue;
  77. }
  78. return $result;
  79. }
  80. /**
  81. * Gets queues.
  82. *
  83. * @return array.
  84. */
  85. public function getQueues()
  86. {
  87. return $this->_queues;
  88. }
  89. /**
  90. * Sets queues.
  91. *
  92. * @param array $queues list of queues
  93. *
  94. * @return none.
  95. */
  96. public function setQueues($queues)
  97. {
  98. $this->_queues = array();
  99. foreach ($queues as $queue) {
  100. $this->_queues[] = clone $queue;
  101. }
  102. }
  103. /**
  104. * Gets prefix.
  105. *
  106. * @return string.
  107. */
  108. public function getPrefix()
  109. {
  110. return $this->_prefix;
  111. }
  112. /**
  113. * Sets prefix.
  114. *
  115. * @param string $prefix value.
  116. *
  117. * @return none.
  118. */
  119. public function setPrefix($prefix)
  120. {
  121. $this->_prefix = $prefix;
  122. }
  123. /**
  124. * Gets marker.
  125. *
  126. * @return string.
  127. */
  128. public function getMarker()
  129. {
  130. return $this->_marker;
  131. }
  132. /**
  133. * Sets marker.
  134. *
  135. * @param string $marker value.
  136. *
  137. * @return none.
  138. */
  139. public function setMarker($marker)
  140. {
  141. $this->_marker = $marker;
  142. }
  143. /**
  144. * Gets max results.
  145. *
  146. * @return string.
  147. */
  148. public function getMaxResults()
  149. {
  150. return $this->_maxResults;
  151. }
  152. /**
  153. * Sets max results.
  154. *
  155. * @param string $maxResults value.
  156. *
  157. * @return none.
  158. */
  159. public function setMaxResults($maxResults)
  160. {
  161. $this->_maxResults = $maxResults;
  162. }
  163. /**
  164. * Gets next marker.
  165. *
  166. * @return string.
  167. */
  168. public function getNextMarker()
  169. {
  170. return $this->_nextMarker;
  171. }
  172. /**
  173. * Sets next marker.
  174. *
  175. * @param string $nextMarker value.
  176. *
  177. * @return none.
  178. */
  179. public function setNextMarker($nextMarker)
  180. {
  181. $this->_nextMarker = $nextMarker;
  182. }
  183. }