HttpHeader.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: JZ
  5. * Date: 2019/7/18
  6. * Time: 20:58
  7. */
  8. class HttpHeader{
  9. private $accessToken;
  10. private $agentToken;
  11. private $timestamp;
  12. private $signature;
  13. private $version;
  14. private $nonce;
  15. private $agentSignautre;
  16. public function __construct() {
  17. $count = func_num_args();
  18. $args=func_get_args();
  19. if (method_exists($this,$f='__construct'.$count)) {
  20. call_user_func_array(array($this,$f),$args);
  21. }
  22. }
  23. public function __construct5($accessToken, $timestamp, $signature, $version, $nonce) {
  24. $this->accessToken = $accessToken;
  25. $this->timestamp = $timestamp;
  26. $this->signature = $signature;
  27. $this->version = $version;
  28. $this->nonce = $nonce;
  29. }
  30. /**
  31. * HttpHeader constructor.
  32. * @param $timestamp
  33. * @param $accessToken
  34. * @param $signature
  35. * @param $version
  36. */
  37. public function __construct7($accessToken, $agentToken, $timestamp, $signature, $agentSignautre, $version, $nonce) {
  38. $this->accessToken = $accessToken;
  39. $this->agentToken = $agentToken;
  40. $this->timestamp = $timestamp;
  41. $this->signature = $signature;
  42. $this->agentSignautre = $agentSignautre;
  43. $this->version = $version;
  44. $this->nonce = $nonce;
  45. }
  46. public function getArray(){
  47. $headers = array(
  48. 'x-qys-open-accesstoken:'.$this->accessToken,
  49. 'x-qys-open-signature:'.$this->signature,
  50. 'x-qys-open-timestamp:'.$this->timestamp,
  51. 'User-Agent:'.'qiyuesuo-php-sdk',
  52. 'version:'.SDKClient::SDK_VERSION,
  53. 'x-qys-open-nonce:'.$this->nonce
  54. );
  55. return $headers;
  56. }
  57. public function getAgentArray(){
  58. $headers = array(
  59. 'x-qys-open-accesstoken:'.$this->accessToken,
  60. 'x-qys-open-signature:'.$this->signature,
  61. 'x-qys-open-agentaccesstoken:'.$this->agentToken,
  62. 'x-qys-open-agentsignature:'.$this->agentSignautre,
  63. 'x-qys-open-timestamp:'.$this->timestamp,
  64. 'User-Agent:'.'qiyuesuo-php-sdk',
  65. 'version:'.SDKClient::SDK_VERSION,
  66. 'x-qys-open-nonce:'.$this->nonce
  67. );
  68. return $headers;
  69. }
  70. /**
  71. * @return mixed
  72. */
  73. public function getTimestamp()
  74. {
  75. return $this->timestamp;
  76. }
  77. /**
  78. * @return mixed
  79. */
  80. public function getAccessToken()
  81. {
  82. return $this->accessToken;
  83. }
  84. /**
  85. * @return mixed
  86. */
  87. public function getSignature()
  88. {
  89. return $this->signature;
  90. }
  91. /**
  92. * @return mixed
  93. */
  94. public function getVersion()
  95. {
  96. return $this->version;
  97. }
  98. /**
  99. * @return mixed
  100. */
  101. public function getNonce()
  102. {
  103. return $this->nonce;
  104. }
  105. }