AclResult.php 720 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace OSS\Result;
  3. use OSS\Core\OssException;
  4. /**
  5. * The type of the return value of getBucketAcl, it wraps the data parsed from xml.
  6. *
  7. * @package OSS\Result
  8. */
  9. class AclResult extends Result
  10. {
  11. /**
  12. * @return string
  13. * @throws OssException
  14. */
  15. protected function parseDataFromResponse()
  16. {
  17. $content = $this->rawResponse->body;
  18. if (empty($content)) {
  19. throw new OssException("body is null");
  20. }
  21. $xml = simplexml_load_string($content);
  22. if (isset($xml->AccessControlList->Grant)) {
  23. return strval($xml->AccessControlList->Grant);
  24. } else {
  25. throw new OssException("xml format exception");
  26. }
  27. }
  28. }