#[Package('checkout')]
class DocumentConfigurationFactory{ private function __construct() { // Factory is Static
} public static function createConfiguration(array
$specificConfig, ?DocumentBaseConfigEntity ...
$configs): DocumentConfiguration
{ $configs =
array_filter($configs);
$documentConfiguration =
new DocumentConfiguration();
foreach ($configs as $config) { $documentConfiguration =
static::
mergeConfiguration($documentConfiguration,
$config);
} $documentConfiguration =
static::
mergeConfiguration($documentConfiguration,
$specificConfig);
return $documentConfiguration;
} public static function mergeConfiguration(DocumentConfiguration
$baseConfig, DocumentBaseConfigEntity|DocumentConfiguration|array
$additionalConfig): DocumentConfiguration
{ $additionalConfigArray =
[];