GetWebsiteResult.php 875 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace OSS\Result;
  3. use OSS\Model\WebsiteConfig;
  4. /**
  5. * Class GetWebsiteResult
  6. * @package OSS\Result
  7. */
  8. class GetWebsiteResult extends Result
  9. {
  10. /**
  11. * 解析WebsiteConfig数据
  12. *
  13. * @return WebsiteConfig
  14. */
  15. protected function parseDataFromResponse()
  16. {
  17. $content = $this->rawResponse->body;
  18. $config = new WebsiteConfig();
  19. $config->parseFromXml($content);
  20. return $config;
  21. }
  22. /**
  23. * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种
  24. * 有效响应
  25. *
  26. * @return bool
  27. */
  28. protected function isResponseOk()
  29. {
  30. $status = $this->rawResponse->status;
  31. if ((int)(intval($status) / 100) == 2 || (int)(intval($status)) === 404) {
  32. return true;
  33. }
  34. return false;
  35. }
  36. }