hasOption('resourceloader')) { $this->setOptions( array( 'resourceloader' => $application->getOption( 'resourceloader' ) ) ); } $this->getResourceLoader(); if (!$this->hasPluginResource('FrontController')) { $this->registerPluginResource('FrontController'); } } /** * Run the application * * Checks to see that we have a default controller directory. If not, an * exception is thrown. * * If so, it registers the bootstrap with the 'bootstrap' parameter of * the front controller, and dispatches the front controller. * * @return mixed * @throws Zend_Application_Bootstrap_Exception */ public function run() { $front = $this->getResource('FrontController'); $default = $front->getDefaultModule(); if (null === $front->getControllerDirectory($default)) { throw new Zend_Application_Bootstrap_Exception( 'No default controller directory registered with front controller' ); } $front->setParam('bootstrap', $this); $response = $front->dispatch(); if ($front->returnResponse()) { return $response; } } /** * Set module resource loader * * @param Zend_Loader_Autoloader_Resource $loader * @return Zend_Application_Module_Bootstrap */ public function setResourceLoader(Zend_Loader_Autoloader_Resource $loader) { $this->_resourceLoader = $loader; return $this; } /** * Retrieve module resource loader * * @return Zend_Loader_Autoloader_Resource */ public function getResourceLoader() { if ((null === $this->_resourceLoader) && (false !== ($namespace = $this->getAppNamespace())) ) { $r = new ReflectionClass($this); $path = $r->getFileName(); $this->setResourceLoader( new Zend_Application_Module_Autoloader( array( 'namespace' => $namespace, 'basePath' => dirname($path), ) ) ); } return $this->_resourceLoader; } /** * Get application namespace (used for module autoloading) * * @return string */ public function getAppNamespace() { return $this->_appNamespace; } /** * Set application namespace (for module autoloading) * * @param string * @return Zend_Application_Bootstrap_Bootstrap */ public function setAppNamespace($value) { $this->_appNamespace = (string) $value; return $this; } }