説明なし

BaseRequest.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace AliyunMNS\Requests;
  3. abstract class BaseRequest
  4. {
  5. protected $headers;
  6. protected $resourcePath;
  7. protected $method;
  8. protected $body;
  9. protected $queryString;
  10. public function __construct($method, $resourcePath) {
  11. $this->method = $method;
  12. $this->resourcePath = $resourcePath;
  13. }
  14. abstract public function generateBody();
  15. abstract public function generateQueryString();
  16. public function setBody($body)
  17. {
  18. $this->body = $body;
  19. }
  20. public function getBody()
  21. {
  22. return $this->body;
  23. }
  24. public function setQueryString($queryString)
  25. {
  26. $this->queryString = $queryString;
  27. }
  28. public function getQueryString()
  29. {
  30. return $this->queryString;
  31. }
  32. public function isHeaderSet($header)
  33. {
  34. return isset($this->headers[$header]);
  35. }
  36. public function getHeaders()
  37. {
  38. return $this->headers;
  39. }
  40. public function removeHeader($header)
  41. {
  42. if (isset($this->headers[$header]))
  43. {
  44. unset($this->headers[$header]);
  45. }
  46. }
  47. public function setHeader($header, $value)
  48. {
  49. $this->headers[$header] = $value;
  50. }
  51. public function getResourcePath()
  52. {
  53. return $this->resourcePath;
  54. }
  55. public function getMethod()
  56. {
  57. return $this->method;
  58. }
  59. }
  60. ?>