else { // If the expression was $a = 1 + 2; then we replaced 1 and
// the + is unexpected.
throw new \
Exception('Unexpected token after replacing value.'
);
} break;
} } $buffer .=
$value;
} foreach ($settings as $name =>
$setting) { $buffer .= self::
exportSettingsToPhp($setting, '$' .
$name);
} // Write the new settings file.
if (file_put_contents($settings_file,
$buffer) === FALSE
) { throw new \
Exception("Failed to modify '
$settings_file'. Verify the file permissions."
);
} // In case any $settings variables were written, import them into the
// Settings singleton.
if (!
empty($settings_settings)) { $old_settings = Settings::
getAll();
new Settings($settings_settings +
$old_settings);
}