TaskSystem/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketInfoResult.php
2023-08-09 15:01:26 +08:00

37 lines
859 B
PHP

<?php
namespace OSS\Result;
use OSS\Core\OssException;
use OSS\Model\BucketInfo;
/**
* Class GetBucketResult interface returns the result class, encapsulated
* The returned xml data is parsed
*
* @package OSS\Result
*/
class GetBucketInfoResult extends Result
{
/**
* Parse data from response
*
* @return string
* @throws OssException
*/
protected function parseDataFromResponse()
{
$content = $this->rawResponse->body;
if (empty($content)) {
throw new OssException("body is null");
}
$xml = simplexml_load_string($content);
if (isset($xml->Bucket)) {
$info = new BucketInfo();
$info->parseFromXmlNode($xml->Bucket);
return $info;
} else {
throw new OssException("xml format exception");
}
}
}