36 lines
		
	
	
		
			898 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			898 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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"];
 | |
|     }
 | |
| } |