12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * Created by PhpStorm.
- * user: JZ
- * Date: 2019/7/12
- * Time: 16:54
- */
- class Category implements JsonSerializable {
- private $id; // 业务分类ID
- private $name; // 业务分类名称
- public function jsonSerialize() {
- $data = [];
- foreach ($this as $key=>$val){
- if ($val !== null) $data[$key] = $val;
- }
- if(sizeof($data) < 1){
- return null;
- }
- return $data;
- }
- /**
- * @return mixed
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @param mixed $id
- */
- public function setId($id)
- {
- $this->id = $id;
- }
- /**
- * @return mixed
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * @param mixed $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
- }
|