(string) $this->uid, 'name' => $this->name, 'summary' => $this->summary, 'type' => $this->type, 'lang' => $this->lang, 'status' => (int) $this->status, 'is_system' => (bool) $this->is_system, 'source_type' => $this->source_type, 'source_id' => $this->source_id, 'owner' => $this->ownerSummary(), 'abilities' => $this->getAttribute('abilities'), 'progress' => $this->when( array_key_exists('progress', $this->resource->getAttributes()), fn () => $this->progress === null ? null : (float) $this->progress, ), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } /** * @return array{kind: string, id: string, nickName: string, realName: string, avatar: string|null} */ private function ownerSummary(): array { if ($this->ownerGroup) { return [ 'kind' => 'team', 'id' => $this->ownerGroup->uid, 'nickName' => $this->ownerGroup->name, 'realName' => $this->ownerGroup->uid, 'avatar' => null, ]; } $user = $this->actor($this->owner); return [ 'kind' => 'user', 'id' => (string) ($user['id'] ?? $this->owner_uid), 'nickName' => (string) ($user['nickName'] ?? ''), 'realName' => (string) ($user['realName'] ?? ''), 'avatar' => $user['avatar'] ?? null, ]; } }