Phue\Command\CreateUser::setDeviceType PHP Method

setDeviceType() public method

Set device type
public setDeviceType ( string $deviceType ) : self
$deviceType string Device type
return self This object
    public function setDeviceType($deviceType)
    {
        if (strlen($deviceType) > 40) {
            throw new \InvalidArgumentException("Device type must not have a length have more than 40 characters");
        }
        $this->deviceType = (string) $deviceType;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Test: Setting invalid device type
  *
  * @covers \Phue\Command\CreateUser::setDeviceType
  *
  * @expectedException \InvalidArgumentException
  */
 public function testExceptionOnInvalidDeviceType()
 {
     $command = new CreateUser();
     $command->setDeviceType(str_repeat('X', 41));
 }