/** * Resolve the Component string into an Object instance. * * @param IDependencyInjectionContainer $container * @param IComponentAdapter $adapter * @return mixed */ public function resolve(IDependencyInjectionContainer $container, IComponentAdapter $adapter) { $instance = $container->getInstanceOf($this->component); if (is_null($instance)) { throw new InjecteeArgumentException("Cannot create '{$this->component}' component, reffered to by '{$adapter->getKey()}' component"); } return $instance; }
/** * Add a component adapter to container's repository * * @param IComponentAdapter $adapter */ public function setComponentAdapter(IComponentAdapter $adapter) { $this->adapters[$adapter->getKey()] = $adapter; }