本文整理汇总了PHP中Rhumsaa\Uuid\Uuid::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Uuid::toString方法的具体用法?PHP Uuid::toString怎么用?PHP Uuid::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhumsaa\Uuid\Uuid
的用法示例。
在下文中一共展示了Uuid::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntryForMessageId
/**
* @param Uuid $messageId
* @return null|MessageLogEntry
*/
public function getEntryForMessageId(Uuid $messageId)
{
if (isset($this->entriesByMessageId[$messageId->toString()])) {
return $this->entriesByMessageId[$messageId->toString()];
}
$query = $this->connection->createQueryBuilder();
$query->select('*')->from(self::TABLE_NAME)->where($query->expr()->eq('message_id', ':message_id'));
$query->setParameter('message_id', $messageId->toString());
$entryData = $query->execute()->fetch(\PDO::FETCH_ASSOC);
if (!$entryData) {
return null;
}
$entry = MessageLogEntry::fromArray($entryData);
$this->entriesByMessageId[$messageId->toString()] = $entry;
return $entry;
}
示例2: find
/**
* @param Uuid $id
*/
public function find(Uuid $id)
{
$teamMember = $this->database->getRecord('SELECT *
FROM team_members
WHERE id = :id', ['id' => $id->getBytes()]);
if (empty($teamMember)) {
throw new \Exception('No teammember with id ' . $id->toString() . 'found');
}
return TeamMember::fromArray($teamMember);
}
示例3: hasAssetMapping
/**
* {@inheritdoc}
*/
public function hasAssetMapping(Uuid $uuid)
{
$expr = Expr::method('getUuid', Expr::method('toString', Expr::same($uuid->toString())))->andX($this->exprBuilder->buildExpression());
return $this->discoveryManager->hasBindingDescriptors($expr);
}
示例4: serializeUuid
public function serializeUuid(VisitorInterface $visitor, Uuid $uuid, array $type, Context $context)
{
return $visitor->visitString($uuid->toString(), $type, $context);
}
示例5: __toString
/**
* Return the object as a string
*
* @return string
*/
public function __toString()
{
return $this->value->toString();
}
示例6: getBinding
/**
* {@inheritdoc}
*/
public function getBinding(Uuid $uuid)
{
if (!isset($this->bindings[$uuid->toString()])) {
throw NoSuchBindingException::forUuid($uuid);
}
return $this->bindings[$uuid->toString()];
}
示例7: getBinding
/**
* {@inheritdoc}
*/
public function getBinding(Uuid $uuid)
{
if (!isset($this->keysByUuid[$uuid->toString()])) {
throw NoSuchBindingException::forUuid($uuid);
}
$key = $this->keysByUuid[$uuid->toString()];
if (!isset($this->bindingsByKey[$key])) {
$this->loadBindingsForKey($key);
}
foreach ($this->bindingsByKey[$key] as $binding) {
if ($binding->getUuid()->equals($uuid)) {
return $binding;
}
}
// This does not happen except if someone plays with the key-value store
// contents (or there's a bug here..)
throw new RuntimeException('The discovery is corrupt. Please rebuild it.');
}
示例8: testActionId
public function testActionId()
{
$this->assertEquals($this->uuid->toString(), $this->command->actionId()->toString());
}
示例9: contains
/**
* Returns whether a binding descriptor exists.
*
* @param Uuid $uuid The UUID of the binding descriptor.
*
* @return bool Returns `true` if a binding descriptor was set for the given
* UUID.
*/
public function contains(Uuid $uuid)
{
return isset($this->map[$uuid->toString()]);
}
示例10: uuid
private function uuid(Uuid $uuid)
{
return $this->defaultExpr()->andSame($uuid->toString(), BindingDescriptor::UUID);
}
示例11: getValue
public function getValue()
{
return $this->uuid->toString();
}
示例12: setUp
protected function setUp()
{
$this->uuid = Uuid::uuid4();
$this->createdAt = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
$this->command = DoSomething::fromArray(['message_name' => 'TestCommand', 'uuid' => $this->uuid->toString(), 'version' => 1, 'created_at' => $this->createdAt, 'payload' => ['command' => 'payload'], 'metadata' => ['command' => 'metadata']]);
}
示例13: forUuid
/**
* Creates an exception for a UUID.
*
* @param Uuid $uuid The UUID of the binding.
* @param Exception|null $cause The exception that caused this exception.
*
* @return static The created exception.
*/
public static function forUuid(Uuid $uuid, Exception $cause = null)
{
return new static(sprintf('The binding "%s" does not exist.', $uuid->toString()), 0, $cause);
}
示例14: hasBindingDescriptor
/**
* Returns whether the binding descriptor exists in this file.
*
* @param Uuid $uuid The UUID of the binding descriptor.
*
* @return bool Whether the file contains the binding descriptor.
*/
public function hasBindingDescriptor(Uuid $uuid)
{
return isset($this->bindingDescriptors[$uuid->toString()]);
}
示例15: setUp
protected function setUp()
{
$this->uuid = Uuid::uuid4();
$this->createdAt = new \DateTimeImmutable();
$this->domainEvent = SomethingWasDone::fromArray(['message_name' => 'TestDomainEvent', 'uuid' => $this->uuid->toString(), 'version' => 1, 'created_at' => $this->createdAt->format(\DateTime::ISO8601), 'payload' => ['event' => 'payload'], 'metadata' => ['event' => 'metadata']]);
}