public function createScript($value, ?int $ttl): string
    {
        $macro = var_export($value, true);

        if (strpos($macro, 'stdClass::__set_state') !== false) {
            $macro = preg_replace_callback("/('([^'\\\\]++|''\\.)')|stdClass::__set_state/", $macro, function($match) {
                return empty($match[1]) ? '(object)' : $match[1];
            });
        }

        return $ttl !== null
            ? "<?php return time() < {$ttl} ? {$macro} : false;"
            : "<?php return {$macro};";
    }