Error.php 631 B

1234567891011121314151617181920212223242526272829303132333435
  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. private $response;
  13. public function __construct($url, $response)
  14. {
  15. $this->url = $url;
  16. $this->response = $response;
  17. }
  18. public function code()
  19. {
  20. return $this->response->statusCode;
  21. }
  22. public function getResponse()
  23. {
  24. return $this->response;
  25. }
  26. public function message()
  27. {
  28. return $this->response->error;
  29. }
  30. }