' . htmlspecialchars($label, ENT_QUOTES, 'UTF-8') . ''; } function module_html(string $value): string { return htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); } function module_wrap(string $content, string $class): string { return '
' . $content . '
'; } function module_if(bool $condition, callable $callback): string { return $condition ? (string) $callback() : ''; } function module_non_empty(?string $value, string $fallback = '—'): string { return $value === null || $value === '' ? $fallback : $value; } function module_capture(string $path): string { ob_start(); include $path; return trim((string) ob_get_clean()); } function module_mode(?int $value, int $autoValue = 1, string $fallback = '—'): string { if ($value === null) { return $fallback; } $isAuto = (int) $value === $autoValue; $label = $isAuto ? 'Auto' : 'Manual'; $class = $isAuto ? 'module-pill--success' : 'module-pill--warn'; return module_status($label, $class); } // phpcs:enable