protected function rebuildPickleParts($pickleSection, array $dlls_add, array $dlls_del = array())
{
$lines = explode("\n", $pickleSection);
$new = [];
/* First add the lines for exts that are requested to be added. */
foreach ($dlls_add as $dll) {
$new[] = $this->buildDllIniLine($dll);
}
/* Then, go over the existing lines, restore those that are not
requested to be deleted and not already added. */
foreach ($lines as $l) {
$l = trim($l);
if (0 !== strpos($l, 'extension')) {
continue;
}
list(, $dllname) = explode('=', $l);
if (in_array(trim($dllname), $dlls_add)) {
/* don't create a duplicated item */
continue;
}
if (in_array(trim($dllname), $dlls_del)) {
/* don't restore as it should be deleted */
continue;
}
$new[] = $l;
}
sort($new);
return implode("\n", $new);
}