Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
JsonSerializer.php
Go to the documentation of this file.
1<?php
2
4
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 This class is part of Ubiquity.
Ubiquity\contents\serializers$SerializerInterface This class is part of Ubiquity.