GetRefererResult.php 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace OSS\Result;
  3. use OSS\Model\RefererConfig;
  4. /**
  5. * Class GetRefererResult
  6. * @package OSS\Result
  7. */
  8. class GetRefererResult extends Result
  9. {
  10. /**
  11. * Parse RefererConfig data
  12. *
  13. * @return RefererConfig
  14. */
  15. protected function parseDataFromResponse()
  16. {
  17. $content = $this->rawResponse->body;
  18. $config = new RefererConfig();
  19. $config->parseFromXml($content);
  20. return $config;
  21. }
  22. /**
  23. * Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface,
  24. * 404 is also considered a valid response
  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. }