public function getSpeakers(): array
    {
        if (is_array($this->speakers)) {
            return $this->speakers;
        }

        $devices = $this->collection->getDevices();
        if (count($devices) < 1) {
            throw new \RuntimeException("No devices in this collection");
        }

        $this->getLogger()->info("creating speaker instances");

        $this->speakers = [];
        foreach ($devices as $device) {
            if (!$device->isSpeaker()) {
                continue;
            }

            $speaker = new Speaker($device);

            try {
                $speaker->getGroup();
            } catch (UnknownGroupException $e) {
                continue;
            }

            $this->speakers[$device->getIp()] = $speaker;
        }

        return $this->speakers;
    }
public function getSpeakers(): array
    {
        if (is_array($this->speakers)) {
            return $this->speakers;
        }

        $devices = $this->collection->getDevices();
        if (count($devices) < 1) {
            throw new \RuntimeException("No devices in this collection");
        }

        $this->getLogger()->info("creating speaker instances");

        $this->speakers = [];
        foreach ($devices as $device) {
            if (!$device->isSpeaker()) {
                continue;
            }

            $speaker = new Speaker($device);

            try {
                $speaker->getGroup();
            } catch (UnknownGroupException $e) {
                continue;
            }

            $this->speakers[$device->getIp()] = $speaker;
        }

        return $this->speakers;
    }
public function getSpeakers ( ) : array { if ( is_array ( $ this -> speakers ) ) { return $ this -> speakers ; } $ devices = $ this -> collection -> getDevices ( ) ; if ( count ( $ devices ) < 1 ) { throw new \ RuntimeException ( "No devices in this collection" ) ; } $ this -> getLogger ( ) -> info ( "creating speaker instances" ) ; $ this -> speakers = [ ] ; foreach ( $ devices as $ device ) { if ( ! $ device -> isSpeaker ( ) ) { continue ; } $ speaker = new Speaker ( $ device ) ; try { $ speaker -> getGroup ( ) ; } catch ( UnknownGroupException $ e ) { continue ; } $ this -> speakers [ $ device -> getIp ( ) ] = $ speaker ; } return $ this -> speakers ; }
Get all the speakers on the network.

@return SpeakerInterface[]
Get all the speakers on the network .