Пример #1
0
 /**
  * PhotoId constructor.
  * @param string $id
  */
 public function __construct($id = null)
 {
     if (is_null($id)) {
         $this->id = RandomIdGenerator::getBase36(8);
     } else {
         if (RandomIdGenerator::isValidBase36($id, 8)) {
             $this->id = $id;
         } else {
             throw new \InvalidArgumentException('Invalid uuid');
         }
     }
 }
 /**
  * @test
  */
 public function testInvalidIds()
 {
     $this->assertFalse(RandomIdGenerator::isValidBase62('', 2));
     $this->assertFalse(RandomIdGenerator::isValidBase36('', 2));
     $this->assertFalse(RandomIdGenerator::isValidBase36('aaaaa', 5));
 }