/** * Resolve dependency for bean $beanStructure * * @param BeanEnvelope $beanEnvelope * * @return void */ public static function resolve(BeanEnvelope $beanEnvelope) { self::$logger = OvoLogger::getLogger(get_class()); self::$logger->debug('Get dependencies form bean ' . $beanEnvelope->getClass()); $beanInstance = $beanEnvelope->getInstance(); $dependencies = $beanEnvelope->getProperties(); if ($dependencies) { foreach ($dependencies as $dependency) { self::injectPropertyDependency($dependency, $beanInstance, $beanEnvelope->getContextReferenceId()); } } }
/** * Check and call init method for bean $beanEnvelope * * @param BeanEnvelope $beanEnvelope * * @return void * * @throw OvoInternalException */ private function callInitMethod(BeanEnvelope $beanEnvelope) { $this->logger->debug('Call Init method'); if ($beanEnvelope->getInitMethod()) { try { Caller::callMethodFromObject($beanEnvelope->getInstance(), $beanEnvelope->getInitMethod()); } catch (OvoContainerException $e) { throw new OvoInternalException($e->getMessage(), $beanEnvelope); } } }