$settings */ final class StyleSettings { /** * @var array */ private array $settings = []; /** * @param array|null $settings Parsed style settings or null. */ public function __construct($settings = null) { $defaults = TemplateDefaults::getDefaultFormStylesSafe(); if (!is_array($settings) || !array_key_exists('stylesEnabled', $settings)) { $this->settings = $defaults; return; } $this->settings = array_replace_recursive($defaults, $settings); } /** * Full style settings tree (non-null after construction). * * @return array */ public function getAll(): array { return $this->settings; } /** * Export for persistence / array merges (same key as API and DB column). * * @return array{styleSettings: array} */ public function toArray(): array { return [ 'styleSettings' => $this->settings, ]; } }