Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
JsonSerializer.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\contents\serializers
;
4
13
class
JsonSerializer
implements
SerializerInterface
{
14
15
public
function
serialize
($object) {
16
return \json_encode ( [
'class'
=> \get_class ( $object ),
'o'
=> $object ] );
17
}
18
19
public
function
unserialize
($serial) {
20
$datas = \json_decode ( $serial );
21
$class = $datas->class;
22
$stdObj = $datas->o;
23
$count = \strlen ( $class );
24
$temp = \serialize ( $stdObj );
25
$temp = \preg_replace (
"@^O:8:\"stdClass\":@"
,
"O:$count:\"$class\":"
, $temp );
26
$o = \unserialize ( $temp );
27
$o->_rest = ( array ) ($o->_rest);
28
return
$o;
29
}
30
}
31
Ubiquity\contents\serializers\JsonSerializer
Ubiquity\contents\serializers$JsonSerializer This class is part of Ubiquity.
Definition
JsonSerializer.php:13
Ubiquity\contents\serializers\JsonSerializer\serialize
serialize($object)
Definition
JsonSerializer.php:15
Ubiquity\contents\serializers\JsonSerializer\unserialize
unserialize($serial)
Definition
JsonSerializer.php:19
Ubiquity\contents\serializers\SerializerInterface
Ubiquity\contents\serializers$SerializerInterface This class is part of Ubiquity.
Definition
SerializerInterface.php:13
Ubiquity\contents\serializers
Definition
JsonSerializer.php:3
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
contents
serializers
JsonSerializer.php
Generated on Sun Dec 10 2023 15:04:13 for
Ubiquity
by
doxygen
1.9.8