Exemple #1
0
 /**
  * @param string $id
  */
 protected function __construct($id)
 {
     if (!is_string($id)) {
         throw new InvalidArgumentException('Id must be a string');
     }
     parent::__construct($id);
 }
Exemple #2
0
 /**
  * @param int $id
  */
 protected function __construct($id)
 {
     if (!is_int($id)) {
         throw new InvalidArgumentException('Id must be an integer');
     }
     parent::__construct($id);
 }
Exemple #3
0
 /**
  * @param string $id
  */
 protected function __construct($id)
 {
     if (!preg_match('/^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$/i', $id)) {
         throw new InvalidArgumentException('Id must be an UUID');
     }
     parent::__construct($id);
 }