You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
require_once "servers/servers-rooms.php";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores Communities and Community servers.
|
|
|
|
*/
|
|
|
|
class CommunityDatabase {
|
|
|
|
private function __construct(array $servers) {
|
|
|
|
$this->servers = $servers;
|
|
|
|
$this->rooms = CommunityServer::enumerate_rooms($servers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var CommunityServer[] $servers
|
|
|
|
*/
|
|
|
|
public array $servers;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var CommunityRoom[] $rooms
|
|
|
|
*/
|
|
|
|
public array $rooms;
|
|
|
|
|
|
|
|
public static function read_from_file(string $rooms_file): CommunityDatabase {
|
|
|
|
$servers = CommunityServer::read_servers_from_file($rooms_file);
|
|
|
|
return new CommunityDatabase($servers);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function fetch_assets(): CommunityDatabase {
|
|
|
|
CommunityRoom::fetch_assets($this->rooms);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function unpack() {
|
|
|
|
return [$this->rooms, $this->servers];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|