public function mergeConfig(SiteConfig $currentConfig, SiteConfig $newConfig)
{
// check for commands where we accept multiple statements (no test_url)
foreach (array('title', 'body', 'strip', 'strip_id_or_class', 'strip_image_src', 'single_page_link', 'next_page_link') as $var) {
// append array elements for this config variable from $newConfig to this config
$currentConfig->{$var} = array_unique(array_merge($currentConfig->{$var}, $newConfig->{$var}));
}
// check for single statement commands
// we do not overwrite existing non null values
foreach (array('tidy', 'prune', 'parser', 'autodetect_on_failure', 'requires_login') as $var) {
if ($currentConfig->{$var} === null) {
$currentConfig->{$var} = $newConfig->{$var};
}
}
// treat find_string and replace_string separately (don't apply array_unique) (thanks fabrizio!)
foreach (array('find_string', 'replace_string') as $var) {
// append array elements for this config variable from $newConfig to this config
$currentConfig->{$var} = array_merge($currentConfig->{$var}, $newConfig->{$var});
}
// merge http_header array from currentConfig into newConfig
// because final values override former values in case of named keys
$currentConfig->http_header = array_merge($newConfig->http_header, $currentConfig->http_header);
return $currentConfig;
}