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.

34 lines
767 B

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