123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?php
- namespace common\util;
- use common\models\Rules;
- use JsonSerializable;
- /**
- * Class RulesObj
- * @package common\util
- * @property int $id
- * @property string $rule_name
- * @property string $rule_content
- * @property string $rule_category
- * @property int $rule_status
- * @property string $create_time
- * @property string $update_time
- * @property string $version
- */
- class RulesObj implements JsonSerializable
- {
- private $id;
- private $rule_name;
- private $rule_category;
- private $rule_content;
- private $rule_status;
- private $create_time;
- private $end_time;
- private $update_time;
- private $version;
- /**
- * @return int
- */
- public function getId(): int
- {
- return $this->id;
- }
- /**
- * @param int $id
- */
- public function setId(int $id)
- {
- $this->id = $id;
- }
- /**
- * @return string
- */
- public function getRuleName(): string
- {
- return $this->rule_name;
- }
- /**
- * @param string $rule_name
- */
- public function setRuleName(string $rule_name)
- {
- $this->rule_name = $rule_name;
- }
- /**
- * @return string
- */
- public function getRuleCategory(): string
- {
- return $this->rule_category;
- }
- /**
- * @param string $rule_category
- */
- public function setRuleCategory(string $rule_category)
- {
- $this->rule_category = $rule_category;
- }
- /**
- * @return int
- */
- public function getRuleStatus(): int
- {
- return $this->rule_status;
- }
- /**
- * @param int $rule_status
- */
- public function setRuleStatus(int $rule_status)
- {
- $this->rule_status = $rule_status;
- }
- /**
- * @return string
- */
- public function getCreateTime(): string
- {
- return $this->create_time;
- }
- /**
- * @param string $create_time
- */
- public function setCreateTime(string $create_time)
- {
- $this->create_time = $create_time;
- }
- /**
- * @return string
- */
- public function getUpdateTime(): string
- {
- return $this->update_time;
- }
- /**
- * @param string $update_time
- */
- public function setUpdateTime(string $update_time)
- {
- $this->update_time = $update_time;
- }
- /**
- * @return string
- */
- public function getVersion(): string
- {
- return $this->version;
- }
- /**
- * @param string $version
- */
- public function setVersion(string $version)
- {
- $this->version = $version;
- }
- public function __construct(Rules $rules)
- {
- $this->id = $rules->id;
- $this->rule_name = $rules->rule_name;
- $this->rule_content = $rules->rule_content;
- $this->rule_category = $rules->rule_category;
- $this->rule_status = $rules->rule_status;
- $this->create_time = $rules->create_time;
- $this->end_time = $rules->end_time;
- $this->update_time = $rules->update_time;
- $this->version = $rules->version;
- }
- /**
- * json_encode无法转化私有属性,需要使用jsonSerialize自定义转换私有的属性
- * @return array
- */
- public function jsonSerialize(): array
- {
- return [
- "id" => $this->id,
- "rule_name" => $this->rule_name,
- "rule_category" => $this->rule_category,
- "rule_content" => $this->rule_content,
- "rule_status" => $this->rule_status,
- "create_time" => $this->create_time,
- "end_time" => $this->end_time,
- "update_time" => $this->update_time,
- "version" => $this->version,
- ];
- }
- }
|