You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuRequestDbo.php 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: robin
  5. * Date: 11/23/15
  6. * Time: 10:47 PM
  7. */
  8. namespace Luticate\Utils;
  9. class LuRequestDbo extends LuDbo
  10. {
  11. /**
  12. * Specify data which should be serialized to JSON
  13. * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
  14. * @return mixed data which can be serialized by <b>json_encode</b>,
  15. * which is a value of any type other than a resource.
  16. * @since 5.4.0
  17. */
  18. function jsonSerialize()
  19. {
  20. return array(
  21. "Version" => $this->_version,
  22. "Data" => $this->_data,
  23. "Message" => $this->_message
  24. );
  25. }
  26. public static function jsonDeserialize($json)
  27. {
  28. $dbo = new LuRequestDbo();
  29. if (isset($json["Version"])) {
  30. $dbo->setVersion($json["Version"]);
  31. }
  32. if (isset($json["Data"])) {
  33. $dbo->setData($json["Data"]);
  34. }
  35. if (isset($json["Message"])) {
  36. $dbo->setMessage($json["Message"]);
  37. }
  38. return $dbo;
  39. }
  40. private $_version;
  41. /**
  42. * @return mixed
  43. */
  44. public function getVersion()
  45. {
  46. return $this->_version;
  47. }
  48. /**
  49. * @param mixed $version
  50. */
  51. public function setVersion($version)
  52. {
  53. $this->_version = $version;
  54. }
  55. private $_data;
  56. /**
  57. * @return mixed
  58. */
  59. public function getData()
  60. {
  61. return $this->_data;
  62. }
  63. /**
  64. * @param mixed $data
  65. */
  66. public function setData($data)
  67. {
  68. $this->_data = $data;
  69. }
  70. private $_message;
  71. /**
  72. * @return mixed
  73. */
  74. public function getMessage()
  75. {
  76. return $this->_message;
  77. }
  78. /**
  79. * @param mixed $message
  80. */
  81. public function setMessage($message)
  82. {
  83. $this->_message = $message;
  84. }
  85. private $_statusCode;
  86. /**
  87. * @return mixed
  88. */
  89. public function getStatusCode()
  90. {
  91. return $this->_statusCode;
  92. }
  93. /**
  94. * @param mixed $statusCode
  95. */
  96. public function setStatusCode($statusCode)
  97. {
  98. $this->_statusCode = $statusCode;
  99. }
  100. }