상속: implements Phue\Command\CommandInterface
예제 #1
0
 /**
  * Test: Send command
  *
  * @covers \Phue\Command\SetGroupAttributes::__construct
  * @covers \Phue\Command\SetGroupAttributes::name
  * @covers \Phue\Command\SetGroupAttributes::lights
  * @covers \Phue\Command\SetGroupAttributes::send
  */
 public function testSend()
 {
     // Build command
     $setGroupAttributesCmd = new SetGroupAttributes($this->mockGroup);
     // Set expected payload
     $this->stubTransportSendRequestWithPayload((object) ['name' => 'Dummy!', 'lights' => [3]]);
     // Change name and lights
     $setGroupAttributesCmd->name('Dummy!')->lights([3])->send($this->mockClient);
 }
예제 #2
0
파일: Group.php 프로젝트: sqmk/phue
 /**
  * Set lights
  *
  * @param array $lights
  *            Light ids or Light objects
  *
  * @return self This object
  */
 public function setLights(array $lights)
 {
     $lightIds = array();
     foreach ($lights as $light) {
         $lightIds[] = (string) $light;
     }
     $x = new SetGroupAttributes($this);
     $y = $x->lights($lightIds);
     $this->client->sendCommand($y);
     $this->attributes->lights = $lightIds;
     return $this;
 }