Error.php 668 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Qiniu\Http;
  3. /**
  4. * 七牛业务请求逻辑错误封装类,主要用来解析API请求返回如下的内容:
  5. * <pre>
  6. * {"error" : "detailed error message"}
  7. * </pre>
  8. */
  9. final class Error
  10. {
  11. private $url;
  12. /**
  13. * @var Response
  14. */
  15. private $response;
  16. public function __construct($url, $response)
  17. {
  18. $this->url = $url;
  19. $this->response = $response;
  20. }
  21. public function code()
  22. {
  23. return $this->response->statusCode;
  24. }
  25. public function getResponse()
  26. {
  27. return $this->response;
  28. }
  29. public function message()
  30. {
  31. return $this->response->error;
  32. }
  33. }