GetStorageCapacityResult.php 769 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace OSS\Result;
  3. use OSS\Core\OssException;
  4. /**
  5. * Class AclResult getBucketAcl接口返回结果类,封装了
  6. * 返回的xml数据的解析
  7. *
  8. * @package OSS\Result
  9. */
  10. class GetStorageCapacityResult extends Result
  11. {
  12. /**
  13. * Parse data from response
  14. *
  15. * @return string
  16. * @throws OssException
  17. */
  18. protected function parseDataFromResponse()
  19. {
  20. $content = $this->rawResponse->body;
  21. if (empty($content)) {
  22. throw new OssException("body is null");
  23. }
  24. $xml = simplexml_load_string($content);
  25. if (isset($xml->StorageCapacity)) {
  26. return intval($xml->StorageCapacity);
  27. } else {
  28. throw new OssException("xml format exception");
  29. }
  30. }
  31. }