![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/mageworx/module-seobase/Serializer/ |
<?php /** * Copyright © 2018 MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\SeoBase\Serializer; class SerializeJson { /** * Serialize value * * @param mixed $value * * @return string * @throws \Exception */ public function serialize($value) { $output = json_encode($value); if ($output === false) { throw new \Exception('Unable to serialize value.'); } return $output; } /** * Un-serialize value * * @param string $json * * @return mixed * @throws \Exception */ public function unserialize($json) { $output = json_decode($json, true); if (json_last_error() !== 0) { throw new \Exception('Unable to unserialize value.'); } return $output; } }