pdo-document/tests/PjsonId.php

24 lines
449 B
PHP
Raw Permalink Normal View History

2024-06-29 15:46:16 +00:00
<?php declare(strict_types=1);
namespace Test;
use Square\Pjson\JsonDataSerializable;
/**
* A serializable ID wrapper class
*/
class PjsonId implements JsonDataSerializable
{
public function __construct(protected string $value) { }
public function toJsonData(): string
{
return $this->value;
}
public static function fromJsonData($jd, array|string $path = []): static
{
return new static($jd);
}
}