duncan3dc\Sonos\Controller::getSpeakers PHP 메소드

getSpeakers() 공개 메소드

Get the speakers that are in the group of this controller.
public getSpeakers ( ) : duncan3dc\Sonos\Speaker[]
리턴 duncan3dc\Sonos\Speaker[]
    public function getSpeakers()
    {
        $group = [];
        $speakers = $this->network->getSpeakers();
        foreach ($speakers as $speaker) {
            if ($speaker->getGroup() === $this->getGroup()) {
                $group[] = $speaker;
            }
        }
        return $group;
    }

Usage Example

예제 #1
0
 /**
  * Get the current volume of all the speakers in this group.
  *
  * @param Controller $controller The Controller to grab the state of
  *
  * @return static
  */
 protected function getVolume(Controller $controller)
 {
     $this->speakers = [];
     foreach ($controller->getSpeakers() as $speaker) {
         $this->speakers[$speaker->getUuid()] = $speaker->getVolume();
     }
     return $this;
 }