/**
  * 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;
 }
 protected function setUp()
 {
     $this->container = new DependencyInjectionContainer();
     $this->container->define('WeakPunch');
     $this->container->define('StrongPunch');
     $this->manyMethods = array(array('fromNothing', array()), array('fromSomePunch', array(new ComponentArgument('WeakPunch'))), array('fromWeakPunch', array(new ComponentArgument('MediumPunch'))), array('fromPunches', array()));
     $this->noMethods = array();
     $this->against = new PunchReceiver();
     $this->adapter = $this->getMock('IComponentAdapter');
     $this->adapter->expects($this->any())->method('getInstance')->will($this->returnValue($this->against));
 }
 /**
  * Add a component adapter to container's repository
  *
  * @param IComponentAdapter $adapter
  */
 public function setComponentAdapter(IComponentAdapter $adapter)
 {
     $this->adapters[$adapter->getKey()] = $adapter;
 }