function testDecoratingComponentAdapterGetDelagate()
 {
     $ca_decorated = new ConstructorInjectionComponentAdapter('Boy');
     $ca_decorating = new DecoratingComponentAdapter($ca_decorated);
     if ($ca_decorating->getDelegate() !== $ca_decorated) {
         $this->fail();
     } else {
         $this->pass();
     }
 }
 /**
  * Get shared instance.
  * If shared instance is null, the decorated Adapter provides
  * object instance.
  *
  * @param IDependencyInjectionContainer $container
  * @return mixed
  */
 public function getInstance(IDependencyInjectionContainer $container)
 {
     if (is_null($this->sharedInstance)) {
         $this->sharedInstance = parent::getInstance($container);
     }
     return $this->sharedInstance;
 }
 /**
  * Get instance of decorated adapter instantiation.
  * Apply methods on object instance.
  *
  * @param IDependencyInjectionContainer $container
  * @return mixed The object instance
  */
 public function getInstance(IDependencyInjectionContainer $container)
 {
     $instance = parent::getInstance($container);
     foreach ($this->getMethods() as $method) {
         list($methodName, $arguments) = $method;
         $methodReflection = new ReflectionMethod($instance, $methodName);
         if (count($arguments)) {
             $resolved = $this->resolveArguments($container, $arguments);
             call_user_func_array(array($instance, $methodName), $resolved);
         } else {
             if ($methodReflection && $methodReflection->getParameters()) {
                 $argsToPass = $this->getArgumentsOfMethod($container, $methodReflection);
                 call_user_func_array(array($instance, $methodName), $argsToPass);
             } else {
                 call_user_func(array($instance, $methodName));
             }
         }
     }
     return $instance;
 }
 public function getComponentInstance(PicoContainer $container)
 {
     require_once $this->includeFileName;
     if (class_exists($this->getDelegate()->getComponentImplementation())) {
         return parent::getComponentInstance($container);
     } else {
         throw new LazyIncludedClassNotDefinedException($this->getDelegate()->getComponentImplementation());
     }
 }