/**
  * 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;
 }