addSharedInstanceWithParameters()

@param  object $instance
@param  string $classOrAlias
@param  array  $params
@return void
489648
public function addSharedInstanceWithParameters($instance, $classOrAlias, array $params)
        {
            ksort($params);
            $hashKey = $this->createHashForKeys($classOrAlias, array_keys($params));
            $hashValue = $this->createHashForValues($classOrAlias, $params);

            if (!isset($this->sharedInstancesWithParams[$hashKey])
                || !is_array($this->sharedInstancesWithParams[$hashKey])) {
                $this->sharedInstancesWithParams[$hashKey] = [];
            }

            $this->sharedInstancesWithParams['hashShort'][$hashKey] = true;
            $this->sharedInstancesWithParams['hashLong'][$hashKey . '/' . $hashValue] = $instance;
        }
1097663
private function addConfigAssociations(ClassMetadata $metadata, $className)
    {
        foreach ($metadata->getAssociationNames() as $association) {
            if (!$metadata->isAssociationInverseSide($association)
                && $metadata->isSingleValuedAssociation($association)) {
                $this->configs[$className][1][$association] = $metadata->getAssociationTargetClass($association);
            }
        }
    }
577783
public function instance($abstract, $instance)
        {
            if (is_array($abstract)) {
                list($abstract, $alias) = $this->extractAlias($abstract);
                $this->alias($abstract, $alias);
            }
            $this->instances[$abstract] = $instance;
        }
755575
public function registerInstance($hint, object $instance): void
	{
		$this->instances[$this->parseHint($hint)] = $instance;
	}
936862
public void addInstance(InstanceInfo i) {
        instancesMap.put(i.getId(), i);
        synchronized (instances) {
            instances.remove(i);
            instances.add(i);
            isDirty = true;
        }
    }
784893
public function addObjectMap(string $classname, $classObject, string $shortName = '', int $instanceId = 0): void
    {
        $this->addCallableMap($classname, function () use ($classObject) {
            return $classObject;
        }, $shortName, $instanceId);
    }
1052911
public function initialize($instance, ServiceLocatorInterface $serviceLocator)
    {
        if ($instance instanceof EventManagerAwareInterface)
            if ($instance->getEventManager() instanceof EventManagerInterface) {
                $instance->getEventManager()->setSharedManager(
                    $serviceLocator->get('SharedEventManager')
                );
            } else {
                $instance->setEventManager($serviceLocator->get('EventManager'));
            }

        if ($instance instanceof ServiceManagerAwareInterface)
            $instance->setServiceManager($serviceLocator);

        if ($instance instanceof ServiceLocatorAwareInterface)
            $instance->setServiceLocator($serviceLocator);
    }
619065
public function add_instance($course, array $fields = null) {
        if ($fields && !empty($fields['cost'])) {
            $fields['cost'] = unformat_float($fields['cost']);
        }
        return parent::add_instance($course, $fields);
    }
1236071
public function store($instance, string $name = null): void
    {
        if ($name === null) {
            $name = get_class($instance);
        }

        $name = $this->getDefinitiveName($name);

        $this->instances[$name] = $instance;
    }
520749
public function add_instance($course, array $fields = NULL) {
        $fields = (array)$fields;

        if (!isset($fields['password'])) {
            $fields['password'] = '';
        }

        return parent::add_instance($course, $fields);
    }
1139028
public function addClassMap(string $classname, ?string $newClassname = null, string $shortName = '', int $instanceId = 0): void
    {
        if ($newClassname === null) {
            $newClassname = $classname;
        }
        $this->addCallableMap($classname, function (Container $container) use ($newClassname) {
            return new $newClassname();
        }, $shortName, $instanceId);
    }
980780
public function replaceInstance(string $hint, object $instance): void
	{
		$hint = $this->resolveAlias($hint);

		if(!isset($this->instances[$hint]))
		{
			throw new ContainerException(vsprintf('Unable to replace [ %s ] as it hasn\'t been registered.', [$hint]));
		}

		$this->instances[$hint] = $instance;

		$this->replaceInstances($hint);
	}
1205971
public function update_instance($instance, $data) {
        global $CFG;

        require_once("$CFG->dirroot/enrol/meta/locallib.php");

        if (!empty($data->customint2) && $data->customint2 == ENROL_META_CREATE_GROUP) {
            $context = context_course::instance($instance->courseid);
            require_capability('moodle/course:managegroups', $context);
            $groupid = enrol_meta_create_new_group($instance->courseid, $data->customint1);
            $data->customint2 = $groupid;
        }

        $result = parent::update_instance($instance, $data);

        enrol_meta_sync($instance->courseid);

        return $result;
    }
177003
public function instance($abstract, $instance)
    {
        $abstract = $this->normalize($abstract);
        if (is_array($abstract)) {
            list($abstract, $alias) = $this->extractAlias($abstract);
            $this->alias($abstract, $alias);
        }
        unset($this->aliases[$abstract]);
        $bound = $this->bound($abstract);

        $this->instances[$abstract] = $instance;
        if ($bound) {
            $this->rebound($abstract);
        }
    }
935156
private void addRelatedInstance(FunctionType constructor, JSTypeBitSet related) {
    checkArgument(constructor.hasInstanceType(),
        "Constructor %s without instance type.", constructor);
    ObjectType instanceType = constructor.getInstanceType();
    addRelatedType(instanceType, related);
  }
927218
public void setInstanceFleets(java.util.Collection<InstanceFleet> instanceFleets) {
        if (instanceFleets == null) {
            this.instanceFleets = null;
            return;
        }

        this.instanceFleets = new com.amazonaws.internal.SdkInternalList<InstanceFleet>(instanceFleets);
    }
139930
public function addInstance(WidgetInstance $instance)
    {
        if (!$this->instances->contains($instance)) {
            $this->instances->add($instance);
            $instance->setContainer($this);
        }
    }