public function getPeerList(bool $forceFlush = false) : array
{
if (!empty($this->peers) && !$forceFlush) {
return $this->peers;
}
$filePath = ROOT . '/config/channel_peers/' . $this->name . '.json';
$peer = [];
if (!\file_exists($filePath)) {
\file_put_contents($filePath, '[]');
return $peer;
}
$json = \Airship\loadJSON($filePath);
foreach ($json as $data) {
$peer[] = new Peer($data);
}
$this->peers = $peer;
return $this->peers;
}