$value) { if (property_exists($this, $key)) { if ($key === 'role' && is_array($value)) { // 배열일 경우, 쉼표로 구분된 문자열로 변환하여 저장 $this->role = implode(DEFAULTS["DELIMITER_ROLE"], $value); } else { $this->{$key} = $value; } } } } public function __get(string $name) { // 'role' 속성을 요청했을 때만 특별히 처리 if ($name === 'role' && is_string($this->role)) { return explode(DEFAULTS["DELIMITER_ROLE"], $this->role); } return parent::__get($name); } public function toArray(): array { return [ 'uid' => $this->uid, 'id' => $this->id, 'passwd' => $this->passwd, 'confirmpassword' => $this->confirmpassword, 'name' => $this->name, 'email' => $this->email, 'mobile' => $this->mobile, 'role' => $this->role, 'status' => $this->status, ]; } }