format('Y-m-d H:i:s.u'); } return gmdate('Y-m-d H:i:s'); } private static function encodeContext(array $context): string { $json = function_exists('wp_json_encode') ? wp_json_encode($context, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) : json_encode($context, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); return is_string($json) ? $json : '{}'; } private static function sanitize(array $context): array { $safe = (new \TFGraphics\SmartImport\Inspector\Redaction\InspectorRedactor())->redact($context)->getValue(); return is_array($safe) ? $safe : []; } private static function writeLine(string $line): void { if (function_exists('wc_get_logger')) { wc_get_logger()->debug($line, ['source' => 'tfsi-runtime']); } } }