public static function smartUnserialize($str, $assoc = true)
    {
        if ($str[0] === '{' || $str[0] === '[') {
            return Json::parse($str, $assoc);
        }

        return Serialization::parse($str);
    }
public static function smartUnserialize($str, $assoc = true)
    {
        if ($str[0] === '{' || $str[0] === '[') {
            return Json::parse($str, $assoc);
        }

        return Serialization::parse($str);
    }
public static function smartUnserialize ( $ str , $ assoc = true ) { if ( $ str [ 0 ] === '{' || $ str [ 0 ] === '[' ) { return Json :: parse ( $ str , $ assoc ) ; } return Serialization :: parse ( $ str ) ; }
Leniently decode a serialized compound data structure, detecting whether
it's dealing with JSON-encoded data or a PHP-serialized string.

@param string $str
@param bool   $assoc

@return mixed
Leniently decode a serialized compound data structure detecting whether it s dealing with JSON - encoded data or a PHP - serialized string .