1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10: class Horde_Controller_Runner
11: {
12: protected $_logger;
13:
14: public function __construct(Horde_Log_Logger $logger)
15: {
16: $this->_logger = $logger;
17: }
18:
19: public function execute(Horde_Injector $injector,
20: Horde_Controller_Request $request,
21: Horde_Controller_RequestConfiguration $config)
22: {
23: $this->_logger->debug('RequestConfiguration in Horde_Controller_Runner: ' . print_r($config, true));
24:
25: $exporter = $injector->getInstance($config->getSettingsExporterName());
26: $exporter->exportBindings($injector);
27:
28: $controller = $config->getControllerName();
29: if (!$controller) {
30: throw new Horde_Controller_Exception('No controller defined');
31: }
32:
33: $implementationBinder = new Horde_Injector_Binder_Implementation($controller);
34: $injector->addBinder('Horde_Controller', new Horde_Injector_Binder_AnnotatedSetters($implementationBinder));
35:
36: $filterRunner = $injector->createInstance('Horde_Controller_FilterRunner');
37: $exporter->exportFilters($filterRunner, $injector);
38:
39: $response = $filterRunner->processRequest($request, $injector->createInstance('Horde_Controller_Response'));
40: if ($response->internalRedirect()) {
41: $this->_logger->debug('Internal redirect');
42: return $this->execute($injector->createChildInjector(), $request, $response->getRedirectConfiguration());
43: }
44:
45: $this->_logger->debug('Returning Horde_Controller_Response');
46: return $response;
47: }
48: }
49: