23 lines
567 B
PHP
23 lines
567 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Infrastructure\Adapters\Services;
|
|
|
|
use Domain\Ports\Services\UuidConverter;
|
|
use Ramsey\Uuid\Uuid;
|
|
use Ramsey\Uuid\UuidInterface;
|
|
use Symfony\Component\Uid\Uuid as SymphonyUuid;
|
|
|
|
class UuidConverterImpl implements UuidConverter
|
|
{
|
|
public function fromBase58(string $uuid): UuidInterface
|
|
{
|
|
return Uuid::fromString(SymphonyUuid::fromBase58($uuid)->toString());
|
|
}
|
|
|
|
public function toBase58(UuidInterface $uuid): string
|
|
{
|
|
return SymphonyUuid::fromString($uuid->toString())->toBase58();
|
|
}
|
|
}
|