Zend Framework 1 is bloated, that's for sure.
The reason for this $_application , which is a bidirectional relation, is a module that is independent of boot files.
This is strange, I think, because when dealing with modules, instead of having the Zend_Aplication set, you will have the main boot file instead:
public function setApplication($application) { if (($application instanceof Zend_Application) || ($application instanceof Zend_Application_Bootstrap_Bootstrapper) ) { if ($application === $this) { throw new Zend_Application_Bootstrap_Exception('Cannot set application to same object; creates recursion'); } $this->_application = $application; } else { throw new Zend_Application_Bootstrap_Exception('Invalid application provided to bootstrap constructor (received "' . get_class($application) . '" instance)'); } return $this; }
There is also a lot of code smell:
public function __construct($application) { $this->setApplication($application); $options = $application->getOptions(); $this->setOptions($options); }
The boostrap file needs parameters, so instead of requesting parameters , it expects Zend_Application to receive the following parameters:
$options = $application->getOptions(); $this->setOptions($options);
It looks like they just ignore the type of interface expected by the setApplication () method, and it can be one of the following:
- Zend_application
- Zend_Application_Bootstrap_Bootstrapper
- Zend_Application_Bootstrap_ResourceBootstrapper
I would give up trying to understand this mess and switch to ZF 2, though;)
Keyne viana
source share