by id */ public array $members = []; /** @var array who signalled a behaviour problem here, and when (550) */ public array $reports = []; /** @var list */ public array $history = []; public function __construct( public readonly string $name, public readonly int $type, public readonly string $creator, public bool $permanent = false, public int $createdAt = 0, ) { $this->createdAt = $createdAt ?: time(); } public function key(): string { return self::keyOf($this->name, $this->type); } public static function keyOf(string $name, int $type): string { return $type . '|' . mb_strtolower($name); } public function count(): int { return count($this->members); } public function isFull(): bool { return $this->count() >= self::MAX_MEMBERS; } public function remember(User $user, string $text): void { $this->history[] = ['id' => $user->id, 'nickname' => $user->nickname, 'text' => $text, 'at' => time()]; if (count($this->history) > self::HISTORY) { $this->history = array_slice($this->history, -self::HISTORY); } } /** The room as a room list shows it: name, "?", creator, members. */ public function listEntry(): array { return [$this->name, '?', $this->creator, (string)$this->count()]; } }