Phue\Command\SetLightState::xy PHP Method

xy() public method

Set xy
public xy ( float $x, float $y ) : self
$x float X value
$y float Y value
return self This object
    public function xy($x, $y)
    {
        // Don't continue if x or y values are invalid
        foreach (array($x, $y) as $value) {
            if (!(self::XY_MIN <= $value && $value <= self::XY_MAX)) {
                throw new \InvalidArgumentException("x/y value must be between " . self::XY_MIN . " and " . self::XY_MAX);
            }
        }
        $this->params['xy'] = array((double) $x, (double) $y);
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Test: Invalid xy value
  *
  * @dataProvider providerInvalidXY
  *
  * @covers \Phue\Command\SetLightState::xy
  *
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidXYValue($x, $y)
 {
     $_x = new SetLightState($this->mockLight);
     $_x->xy($x, $y);
 }
All Usage Examples Of Phue\Command\SetLightState::xy