You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
828 B

6 years ago
  1. <?php
  2. namespace OSS\Result;
  3. use OSS\Model\BucketInfo;
  4. use OSS\Model\BucketListInfo;
  5. /**
  6. * Class ListBucketsResult
  7. *
  8. * @package OSS\Result
  9. */
  10. class ListBucketsResult extends Result
  11. {
  12. /**
  13. * @return BucketListInfo
  14. */
  15. protected function parseDataFromResponse()
  16. {
  17. $bucketList = array();
  18. $content = $this->rawResponse->body;
  19. $xml = new \SimpleXMLElement($content);
  20. if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) {
  21. foreach ($xml->Buckets->Bucket as $bucket) {
  22. $bucketInfo = new BucketInfo(strval($bucket->Location),
  23. strval($bucket->Name),
  24. strval($bucket->CreationDate));
  25. $bucketList[] = $bucketInfo;
  26. }
  27. }
  28. return new BucketListInfo($bucketList);
  29. }
  30. }