0) { self::$defaultFontSize = $value; return true; } return false; } public static function setDefaultRtl(?bool $defaultRtl): void { self::$defaultRtl = $defaultRtl; } public static function isDefaultRtl(): ?bool { return self::$defaultRtl; } /** * Load setting from phpword.yml or phpword.yml.dist. */ public static function loadConfig(?string $filename = null): array { // Get config file $configFile = null; $configPath = __DIR__ . '/../../'; if ($filename !== null) { $files = [$filename]; } else { $files = ["{$configPath}phpword.ini", "{$configPath}phpword.ini.dist"]; } foreach ($files as $file) { if (file_exists($file)) { $configFile = realpath($file); break; } } // Parse config file $config = []; if ($configFile !== null) { $config = @parse_ini_file($configFile); if ($config === false) { return []; } } // Set config value $appliedConfig = []; foreach ($config as $key => $value) { $method = "set{$key}"; if (method_exists(__CLASS__, $method)) { self::$method($value); $appliedConfig[$key] = $value; } } return $appliedConfig; } /** * Get default paper. */ public static function getDefaultPaper(): string { return self::$defaultPaper; } /** * Set default paper. */ public static function setDefaultPaper(string $value): bool { if (trim($value) !== '') { self::$defaultPaper = $value; return true; } return false; } }