No Description

DeleteQueueResponse.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace AliyunMNS\Responses;
  3. use AliyunMNS\Exception\MnsException;
  4. use AliyunMNS\Responses\BaseResponse;
  5. use AliyunMNS\Common\XMLParser;
  6. class DeleteQueueResponse extends BaseResponse
  7. {
  8. public function __construct()
  9. {
  10. }
  11. public function parseResponse($statusCode, $content)
  12. {
  13. $this->statusCode = $statusCode;
  14. if ($statusCode == 204) {
  15. $this->succeed = TRUE;
  16. } else {
  17. $this->parseErrorResponse($statusCode, $content);
  18. }
  19. }
  20. public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
  21. {
  22. $this->succeed = FALSE;
  23. $xmlReader = $this->loadXmlContent($content);
  24. try {
  25. $result = XMLParser::parseNormalError($xmlReader);
  26. throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
  27. } catch (\Exception $e) {
  28. if ($exception != NULL) {
  29. throw $exception;
  30. } elseif($e instanceof MnsException) {
  31. throw $e;
  32. } else {
  33. throw new MnsException($statusCode, $e->getMessage());
  34. }
  35. } catch (\Throwable $t) {
  36. throw new MnsException($statusCode, $t->getMessage());
  37. }
  38. }
  39. }
  40. ?>