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
769 B

6 years ago
  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. }