/** * Converts a value from its database representation to its PHP representation * * @param mixed $value The value to convert * @param AbstractPlatform $platform The currently used database platform * * @return mixed * * @throws ConversionException When the conversion fails */ public function convertToPHPValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof Uuid) { return $value; } try { $uuid = Uuid::parse($value); } catch (Exception $exception) { throw ConversionException::conversionFailed($value, static::TYPE_NAME); } return $uuid; }
/** * {@inheritdoc} */ public function hashValue() : string { return $this->uuid->hashValue(); }
public function test_that_generate_returns_expected_instance() { $thingId = ThingId::generate(); $this->assertTrue(Uuid::isValid($thingId->toString())); }
/** * @expectedException Novuso\System\Exception\DomainException */ public function test_that_time_throws_exception_with_invalid_clock_seq() { $timestamp = '01E5152019E2b262'; $node = '48:2C:6A:1E:59:3D'; $clockSeq = 0xfa00; Uuid::time($node, $clockSeq, $timestamp); }
/** * Creates a sequential pseudo-random Uuid instance * * @param bool $msb Whether or not timestamp covers most significant bits * * @return Uuid */ function uuid(bool $msb = true) : Uuid { return Uuid::comb($msb); }
/** * @expectedException \AssertionError */ public function test_that_compare_to_throws_exception_for_invalid_argument() { $uuid = Uuid::random(); $uuid->compareTo('5f32efa0-2f13-4fcf-87d6-86c86a734247'); }