BucketInfo.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. namespace OSS\Model;
  3. /**
  4. * Bucket information class. This is the type of element in BucketListInfo's
  5. *
  6. * Class BucketInfo
  7. * @package OSS\Model
  8. */
  9. class BucketInfo
  10. {
  11. /**
  12. * BucketInfo constructor.
  13. *
  14. * @param string $location
  15. * @param string $name
  16. * @param string $createDate
  17. */
  18. public function __construct($location = '', $name = '', $createDate = '')
  19. {
  20. $this->location = $location;
  21. $this->createDate = $createDate;
  22. $this->name = $name;
  23. }
  24. /**
  25. * Get bucket location
  26. *
  27. * @return string
  28. */
  29. public function getLocation()
  30. {
  31. return $this->location;
  32. }
  33. /**
  34. * Get bucket name
  35. *
  36. * @return string
  37. */
  38. public function getName()
  39. {
  40. return $this->name;
  41. }
  42. /**
  43. * Get bucket creation time.
  44. *
  45. * @return string
  46. */
  47. public function getCreateDate()
  48. {
  49. return $this->createDate;
  50. }
  51. /**
  52. * Get bucket storage class.
  53. *
  54. * @return string
  55. */
  56. public function getStorageClass()
  57. {
  58. return $this->storageClass;
  59. }
  60. /**
  61. * Get bucket extranet endpoint.
  62. *
  63. * @return string
  64. */
  65. public function getExtranetEndpoint()
  66. {
  67. return $this->extranetEndpoint;
  68. }
  69. /**
  70. * Get bucket intranet endpoint.
  71. *
  72. * @return string
  73. */
  74. public function getIntranetEndpoint()
  75. {
  76. return $this->intranetEndpoint;
  77. }
  78. /**
  79. * Get bucket intranet endpoint.
  80. *
  81. * @return string
  82. */
  83. public function getRegion()
  84. {
  85. return $this->region;
  86. }
  87. /**
  88. * Parse bucket information from node.
  89. *
  90. * @param xml $xml
  91. * @throws OssException
  92. * @return null
  93. */
  94. public function parseFromXmlNode($xml)
  95. {
  96. if (isset($xml->Location)) {
  97. $this->location = strval($xml->Location);
  98. }
  99. if (isset($xml->Name)) {
  100. $this->name = strval($xml->Name);
  101. }
  102. if (isset($xml->CreationDate)) {
  103. $this->createDate = strval($xml->CreationDate);
  104. }
  105. if (isset($xml->StorageClass)) {
  106. $this->storageClass = strval($xml->StorageClass);
  107. }
  108. if (isset($xml->ExtranetEndpoint)) {
  109. $this->extranetEndpoint = strval($xml->ExtranetEndpoint);
  110. }
  111. if (isset($xml->IntranetEndpoint)) {
  112. $this->intranetEndpoint = strval($xml->IntranetEndpoint);
  113. }
  114. if (isset($xml->IntranetEndpoint)) {
  115. $this->intranetEndpoint = strval($xml->IntranetEndpoint);
  116. }
  117. if (isset($xml->Region)) {
  118. $this->region = strval($xml->Region);
  119. }
  120. }
  121. /**
  122. * bucket region
  123. *
  124. * @var string
  125. */
  126. private $location;
  127. /**
  128. * bucket name
  129. *
  130. * @var string
  131. */
  132. private $name;
  133. /**
  134. * bucket creation time
  135. *
  136. * @var string
  137. */
  138. private $createDate;
  139. /**
  140. * bucket storage class
  141. *
  142. * @var string
  143. */
  144. private $storageClass;
  145. /**
  146. * bucket extranet endpoint
  147. *
  148. * @var string
  149. */
  150. private $extranetEndpoint;
  151. /**
  152. * bucket intranet endpoint
  153. *
  154. * @var string
  155. */
  156. private $intranetEndpoint;
  157. /**
  158. * bucket region
  159. *
  160. * @var string
  161. */
  162. private $region;
  163. }