The situation is the following:
We have two themes (parent and child theme). Both of them have the same settings from settings.php and some functions from lib.php are equals.
Themes of Moodle can inherit js, styles ... but in settings.php (as far as I know) it does not.
This is why we've developed a way to solve this problem.
We've created a class 'settings parent' with a function 'settings' where we've got the settings of 'Parent' theme.
We've set 'theme_name' property where we get theme name and use it where we need it.
Later, in settings.php, we've use the settings_parent class by sending the name of the theme and calling the settings function.
And on the part of child theme, in settings_child.php, we've created settings_child class by extending from settings_parent for get parent settings. (We need import settings_parent file from parent theme for extend settings_parent)
If we want, we can add extra settings for child theme.
By last, we've use the settings_child class by sending the name of the theme and calling the settings function.