20250629 1.1 Stable
This commit is contained in:
36
tests/data/C.php
Normal file
36
tests/data/C.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace goodboyalex\php_components_pack\tests\data;
|
||||
|
||||
use goodboyalex\php_components_pack\interfaces\ISerializable;
|
||||
|
||||
class C implements ISerializable
|
||||
{
|
||||
public string $stringC;
|
||||
public int $intC;
|
||||
public bool $boolC;
|
||||
|
||||
public function __construct (string $string = "", int $int = 0, bool $bool = false)
|
||||
{
|
||||
$this->stringC = $string;
|
||||
$this->intC = $int;
|
||||
$this->boolC = $bool;
|
||||
}
|
||||
|
||||
public function Serialize (): string
|
||||
{
|
||||
$array = [];
|
||||
$array["string"] = $this->stringC;
|
||||
$array["int"] = $this->intC;
|
||||
$array["bool"] = $this->boolC;
|
||||
return json_encode($array);
|
||||
}
|
||||
|
||||
public function UnSerialize (string $serialized): void
|
||||
{
|
||||
$array = json_decode($serialized, true);
|
||||
$this->stringC = $array["string"];
|
||||
$this->intC = $array["int"];
|
||||
$this->boolC = $array["bool"];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user