id; } /** * @param mixed $id */ public function setId($id) { $this->id = $id; } /** * @return mixed */ public function getPid(): int { return $this->pid; } /** * @param mixed $pid */ public function setPid($pid) { $this->pid = $pid; } /** * @return mixed */ public function getName(): string { return $this->name; } /** * @param mixed $name */ public function setName($name) { $this->name = $name; } /** * @return mixed */ public function getStatus(): int { return $this->status; } /** * @param mixed $status */ public function setStatus($status) { $this->status = $status; } /** * @return array */ public function getChildren(): array { return $this->children; } /** * @param array $children */ public function setChildren(array $children) { $this->children = $children; } /** * @param DictionaryObj $children */ public function addChildrenToTop(DictionaryObj $children) { array_unshift($this->children, $children); } /** * @param DictionaryObj $children */ public function addChildrenToBottom(DictionaryObj $children) { $this->children[] = $children; } /** * @return mixed */ public function getMultiple(): int { return $this->multiple; } /** * @param mixed $multiple */ public function setMultiple($multiple) { $this->multiple = $multiple; } /** * @return array */ public function getDerive(): array { return $this->derive; } /** * @param DeriveObj $derive */ public function addDeriveToTop(DeriveObj $derive) { array_unshift($this->derive, $derive); } /** * @param DeriveObj $derive */ public function addDeriveToBottom(DeriveObj $derive) { $this->derive[] = $derive; } /** * @param array $derive */ public function setDerive(array $derive) { $this->derive = $derive; } public function __construct($id, $pid, $name, $status, $multiple, $has_children, $can_change, $can_children, $can_multiple,$sort) { $this->id = $id; $this->pid = $pid; $this->name = $name; $this->status = $status; $this->multiple = $multiple; $this->has_children = $has_children; $this->can_change = $can_change; $this->can_children = $can_children; $this->can_multiple = $can_multiple; $this->sort = $sort; } /** * json_encode无法转化私有属性,需要使用jsonSerialize自定义转换私有的属性 * @return array */ public function jsonSerialize(): array { return [ "id" => $this->id, "pid" => $this->pid, "name" => $this->name, "status" => $this->status, "multiple" => $this->multiple, "children" => $this->children, "derive" => $this->derive, "has_children" => $this->has_children, "can_change" => $this->can_change, "can_children" => $this->can_children, "can_multiple" => $this->can_multiple, "sort" => $this->sort, ]; } }