Phue\Command\UpdateSensorState::stateAttribute PHP Method

stateAttribute() public method

State attribute
public stateAttribute ( string $key, mixed $value ) : self
$key string Key
$value mixed Value
return self This object
    public function stateAttribute($key, $value)
    {
        $this->state[$key] = $value;
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Test: Send
  *
  * @covers \Phue\Command\UpdateSensorState::send
  */
 public function testSend()
 {
     // Mock client
     $mockClient = Mockery::mock('\\Phue\\Client', array('getUsername' => 'abcdefabcdef01234567890123456789'))->makePartial();
     // Mock client commands
     $mockClient->shouldReceive('getTransport->sendRequest');
     // $command = (new UpdateSensorState('5'))
     // ->stateAttribute('key', 'value')
     // ->send($mockClient);
     $sensor = new UpdateSensorState('5');
     $command = $sensor->stateAttribute('key', 'value')->send($mockClient);
 }