/** * Calls init method and register shutdown method. * * @param object $bean * @param BeanDefinition $definition * * @return void */ private function _setupInitAndShutdown($bean, BeanDefinition $definition) { if ($definition->hasInitMethod()) { $initMethod = $definition->getInitMethod(); $bean->{$initMethod}(); } if ($definition->hasDestroyMethod()) { $destroyMethod = $definition->getDestroyMethod(); $this->registerShutdownMethod($bean, $destroyMethod); } }