Add pjson support
This commit is contained in:
23
tests/PjsonId.php
Normal file
23
tests/PjsonId.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user