Airship\Engine\Continuum\Channel::getPeerList PHP Method

getPeerList() public method

Get a list of peers for a given channel
public getPeerList ( boolean $forceFlush = false ) : array
$forceFlush boolean
return array
    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;
    }