TemplateParam.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * user: JZ
  5. * Date: 2019/7/13
  6. * Time: 12:42
  7. */
  8. class TemplateParam implements JsonSerializable {
  9. private $name; // 文档参数名称
  10. private $value; // 文档参数默认填充值
  11. private $required; //是否必填
  12. private $type;
  13. public function jsonSerialize() {
  14. $data = [];
  15. foreach ($this as $key=>$val){
  16. if ($val !== null) $data[$key] = $val;
  17. }
  18. if(sizeof($data) < 1){
  19. return null;
  20. }
  21. return $data;
  22. }
  23. /**
  24. * @return mixed
  25. */
  26. public function getName()
  27. {
  28. return $this->name;
  29. }
  30. /**
  31. * @param mixed $name
  32. */
  33. public function setName($name)
  34. {
  35. $this->name = $name;
  36. }
  37. /**
  38. * @return mixed
  39. */
  40. public function getValue()
  41. {
  42. return $this->value;
  43. }
  44. /**
  45. * @param mixed $value
  46. */
  47. public function setValue($value)
  48. {
  49. $this->value = $value;
  50. }
  51. /**
  52. * @return mixed
  53. */
  54. public function getRequired()
  55. {
  56. return $this->required;
  57. }
  58. /**
  59. * @param mixed $required
  60. */
  61. public function setRequired($required)
  62. {
  63. $this->required = $required;
  64. }
  65. /**
  66. * @return mixed
  67. */
  68. public function getType()
  69. {
  70. return $this->type;
  71. }
  72. /**
  73. * @param mixed $type
  74. */
  75. public function setType($type)
  76. {
  77. $this->type = $type;
  78. }
  79. }