コード例 #1
0
ファイル: Event.php プロジェクト: rask/wplog
 /**
  * Event constructor. Get an UUID for the event.
  *
  * @since 0.1.0
  * @return void
  */
 public function __construct()
 {
     $this->uuid = Uuid::getUuid();
     $now = new \DateTime('now');
     $now->setTimezone(new \DateTimeZone('UTC'));
     $timestamp = $now->format('Y-m-d H:i:s');
     $this->timestamp = $timestamp;
 }
コード例 #2
0
ファイル: UuidTest.php プロジェクト: rask/wplog
 function testItUnpacksUuidsFromBinaryForm()
 {
     $uuid = Uuid::getUuid();
     $packed = Uuid::pack($uuid);
     $unpacked = Uuid::unpack($packed);
     $this->assertRegExp('%^[0-9A-Za-z-]+$%', $unpacked);
     $this->assertEquals($unpacked, $uuid);
 }