Category.php 920 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * user: JZ
  5. * Date: 2019/7/12
  6. * Time: 16:54
  7. */
  8. class Category implements JsonSerializable {
  9. private $id; // 业务分类ID
  10. private $name; // 业务分类名称
  11. public function jsonSerialize() {
  12. $data = [];
  13. foreach ($this as $key=>$val){
  14. if ($val !== null) $data[$key] = $val;
  15. }
  16. if(sizeof($data) < 1){
  17. return null;
  18. }
  19. return $data;
  20. }
  21. /**
  22. * @return mixed
  23. */
  24. public function getId()
  25. {
  26. return $this->id;
  27. }
  28. /**
  29. * @param mixed $id
  30. */
  31. public function setId($id)
  32. {
  33. $this->id = $id;
  34. }
  35. /**
  36. * @return mixed
  37. */
  38. public function getName()
  39. {
  40. return $this->name;
  41. }
  42. /**
  43. * @param mixed $name
  44. */
  45. public function setName($name)
  46. {
  47. $this->name = $name;
  48. }
  49. }