1: <?php
2: /**
3: * @category Horde
4: * @package Core
5: */
6: class Horde_Core_Controller_SettingsFinder
7: {
8: public function getSettingsExporterName($controllerName)
9: {
10: $settingsName = $this->_mapName($controllerName);
11: $current = $controllerName;
12: while (class_exists($current)) {
13: $settingsName = $this->_mapName($current);
14: if (class_exists($settingsName)) {
15: return $settingsName;
16: }
17:
18: $current = $this->_getParentName($current);
19: }
20:
21: return 'Horde_Controller_SettingsExporter_Default';
22: }
23:
24: private function _mapName($controllerName)
25: {
26: return str_replace('_Controller', '_SettingsExporter', $controllerName);
27: }
28:
29: private function _getParentName($controllerName)
30: {
31: $klass = new ReflectionClass($controllerName);
32: $parent = $klass->getParentClass();
33: return $parent->name;
34: }
35: }
36: