Phue\Command\StartSensorScan::send PHP Method

send() public method

Send command
public send ( Client $client ) : mixed
$client Phue\Client Phue Client
return mixed
    public function send(Client $client)
    {
        // Get response
        $response = $client->getTransport()->sendRequest("/api/{$client->getUsername()}/sensors", TransportInterface::METHOD_POST);
        return $response;
    }

Usage Example

Example #1
0
 /**
  * Test: Send start sensor scan command
  *
  * @covers \Phue\Command\StartSensorScan::send
  */
 public function testSend()
 {
     // Stub transport's sendRequest method
     $this->mockTransport->expects($this->once())->method('sendRequest')->with($this->equalTo("/api/{$this->mockClient->getUsername()}/sensors"), $this->equalTo('POST'))->will($this->returnValue('success!'));
     $sensor = new StartSensorScan();
     $this->assertEquals('success!', $sensor->send($this->mockClient));
 }
StartSensorScan