/**
  * @singleton method used to instantiate class object
  * @access    public
  * @param  \EE_Request  $request
  * @param  \EE_Response $response
  * @return \EE_Dependency_Map instance
  */
 public static function instance(EE_Request $request = null, EE_Response $response = null)
 {
     // check if class object is instantiated, and instantiated properly
     if (!self::$_instance instanceof EE_Dependency_Map) {
         self::$_instance = new EE_Dependency_Map($request, $response);
     }
     return self::$_instance;
 }
 /**
  * @access protected
  * @param string $class_name
  * @param string $param_class
  * @param array $arguments
  * @param mixed $index
  * @return array
  */
 protected function _resolve_dependency($class_name, $param_class, $arguments, $index)
 {
     $dependency = null;
     // should dependency be loaded from cache ?
     $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency($class_name, $param_class) !== EE_Dependency_Map::load_new_object ? true : false;
     // we might have a dependency...
     // let's MAYBE try and find it in our cache if that's what's been requested
     $cached_class = $cache_on ? $this->_get_cached_class($param_class) : null;
     // and grab it if it exists
     if ($cached_class instanceof $param_class) {
         $dependency = $cached_class;
     } else {
         if ($param_class != $class_name) {
             // obtain the loader method from the dependency map
             $loader = $this->_dependency_map->class_loader($param_class);
             // is loader a custom closure ?
             if ($loader instanceof Closure) {
                 $dependency = $loader();
             } else {
                 // set the cache on property for the recursive loading call
                 $this->_cache_on = $cache_on;
                 // if not, then let's try and load it via the registry
                 $dependency = $this->{$loader}($param_class);
             }
         }
     }
     // did we successfully find the correct dependency ?
     if ($dependency instanceof $param_class) {
         // then let's inject it into the incoming array of arguments at the correct location
         if (isset($argument_keys[$index])) {
             $arguments[$argument_keys[$index]] = $dependency;
         } else {
             $arguments[$index] = $dependency;
         }
     }
     return $arguments;
 }
 /**
  * 	_load_registry
  *
  * 	@access private
  * 	@return EE_Dependency_Map
  */
 private function _load_dependency_map()
 {
     if (!is_readable(EE_CORE . 'EE_Dependency_Map.core.php')) {
         EE_Error::add_error(__('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
         wp_die(EE_Error::get_notices());
     }
     require_once EE_CORE . 'EE_Dependency_Map.core.php';
     return EE_Dependency_Map::instance($this->request, $this->response);
 }