Document.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * user: JZ
  5. * Date: 2019/7/13
  6. * Time: 13:06
  7. */
  8. class Document implements JsonSerializable {
  9. private $id;
  10. private $title;
  11. private $pageCount;
  12. private $createTime;
  13. private $contentType;
  14. private $params;
  15. public function jsonSerialize() {
  16. $data = [];
  17. foreach ($this as $key=>$val){
  18. if ($val !== null) $data[$key] = $val;
  19. }
  20. if(sizeof($data) < 1){
  21. return null;
  22. }
  23. return $data;
  24. }
  25. /**
  26. * @return mixed
  27. */
  28. public function getId()
  29. {
  30. return $this->id;
  31. }
  32. /**
  33. * @param mixed $id
  34. */
  35. public function setId($id)
  36. {
  37. $this->id = $id;
  38. }
  39. /**
  40. * @return mixed
  41. */
  42. public function getTitle()
  43. {
  44. return $this->title;
  45. }
  46. /**
  47. * @param mixed $title
  48. */
  49. public function setTitle($title)
  50. {
  51. $this->title = $title;
  52. }
  53. /**
  54. * @return mixed
  55. */
  56. public function getPageCount()
  57. {
  58. return $this->pageCount;
  59. }
  60. /**
  61. * @param mixed $pageCount
  62. */
  63. public function setPageCount($pageCount)
  64. {
  65. $this->pageCount = $pageCount;
  66. }
  67. /**
  68. * @return mixed
  69. */
  70. public function getCreateTime()
  71. {
  72. return $this->createTime;
  73. }
  74. /**
  75. * @param mixed $createTime
  76. */
  77. public function setCreateTime($createTime)
  78. {
  79. $this->createTime = $createTime;
  80. }
  81. /**
  82. * @return mixed
  83. */
  84. public function getParams()
  85. {
  86. return $this->params;
  87. }
  88. /**
  89. * @param mixed $params
  90. */
  91. public function setParams($params)
  92. {
  93. $this->params = $params;
  94. }
  95. /**
  96. * @return mixed
  97. */
  98. public function getContentType()
  99. {
  100. return $this->contentType;
  101. }
  102. /**
  103. * @param mixed $contentType
  104. */
  105. public function setContentType($contentType)
  106. {
  107. $this->contentType = $contentType;
  108. }
  109. }