Esempio n. 1
0
 /**
  * @param int         $id      Device id
  * @param string|null $command SIS-PM command to use
  *
  * @throws \InvalidArgumentException If invalid device id was specified
  */
 public function __construct($id = 0, $command = null)
 {
     if (!is_int($id)) {
         throw new \InvalidArgumentException(sprintf('Device id has to be an integer, %s given', gettype($id)));
     }
     $this->id = (int) $id;
     parent::__construct($command);
 }
Esempio n. 2
0
 /**
  * @param string      $serial  Serial number of the device
  * @param string|null $command SIS-PM command to use
  *
  * @throws \InvalidArgumentException If invalid serial number was specified
  */
 public function __construct($serial, $command = null)
 {
     if (false === strpos($serial, ':')) {
         throw new \InvalidArgumentException(sprintf('Serial number %s is invalid', $serial));
     }
     $this->serial = $serial;
     parent::__construct($command);
 }