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.
33 lines
828 B
33 lines
828 B
1 year ago
|
<?php
|
||
|
|
||
|
namespace OSS\Result;
|
||
|
|
||
|
use OSS\Model\BucketInfo;
|
||
|
use OSS\Model\BucketListInfo;
|
||
|
|
||
|
/**
|
||
|
* Class ListBucketsResult
|
||
|
*
|
||
|
* @package OSS\Result
|
||
|
*/
|
||
|
class ListBucketsResult extends Result
|
||
|
{
|
||
|
/**
|
||
|
* @return BucketListInfo
|
||
|
*/
|
||
|
protected function parseDataFromResponse()
|
||
|
{
|
||
|
$bucketList = array();
|
||
|
$content = $this->rawResponse->body;
|
||
|
$xml = new \SimpleXMLElement($content);
|
||
|
if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) {
|
||
|
foreach ($xml->Buckets->Bucket as $bucket) {
|
||
|
$bucketInfo = new BucketInfo(strval($bucket->Location),
|
||
|
strval($bucket->Name),
|
||
|
strval($bucket->CreationDate));
|
||
|
$bucketList[] = $bucketInfo;
|
||
|
}
|
||
|
}
|
||
|
return new BucketListInfo($bucketList);
|
||
|
}
|
||
|
}
|