@param      $id
@param      $object
@param bool $immutable
@param bool $singleton

@return void
489057
public function bind($id, $object, $immutable = true, $singleton = false)
    {
        if (isset($this->bindings[$id])) {
            if (isset($this->immutables[$id])) {
                throw new ConflictException($this->bindings[$id], new ConflictException($id));
            }

            unset($this->singletons[$id]);
            unset($this->immutables[$id]);
        }

        $this->bindings[$id] = $object;

        if ($immutable) {
            $this->immutables[$id] = true;
        }

        if ($singleton) {
            $this->singletons[$id] = true;
        }
    }
18860
public function registerManaged($entity, array $id, array $data)
    {
        $isProxy = $entity instanceof GhostObjectInterface && ! $entity->isProxyInitialized();
        $oid     = spl_object_id($entity);

        $this->entityIdentifiers[$oid]  = $id;
        $this->entityStates[$oid]       = self::STATE_MANAGED;
        $this->originalEntityData[$oid] = $data;

        $this->addToIdentityMap($entity);

        if ($entity instanceof NotifyPropertyChanged && ! $isProxy) {
            $entity->addPropertyChangedListener($this);
        }
    }
773614
public static void initialize(SingletonProvider instance) {
        synchronized (SingletonProvider.class) {
            if (INSTANCE == null) {
                INSTANCE = instance;
            } else {
                throw new RuntimeException("SingletonProvider is already initialized with " + INSTANCE);
            }
        }
    }
309706
public function delete($id)
    {
        if ($this->has($id)) {
            //remove instance
            unset($this->instances[$id]);

            //remove interface reference if exists
            foreach ($this->interfaces as $int => $classes) {
                $key = array_search($id, $classes);
                if ($key !== false) {
                    unset($classes[$key]);
                    $this->interfaces[$int] = $classes;
                }
            }

            //remove instance from singleton binding
            if ($this->hasDefinition($id)) {
                $definition = $this->getDefinition($id);
                if ($definition instanceof Singleton) {
                    $definition->deleteStoredInstance();
                }
            }
        }
        return $this;
    }
286700
protected function setInstance(string $name, $object):bool
    {
        if (!isset(self::$instances[$name])) {
            self::$instances[$name] = $object;
            return (true);
        }
        throw new Server500(new \ArrayObject(array("explain" => "Cannot redeclare instance name $name as new instance",
            "solution" => "Please use SingletonMulPattern correctly")));
    }
215601
public function bind($name, \Closure $callable, $singleton = false)
    {
        $this->_ioc[$name] = array(
            'closure'   => $callable,
            'singleton' => (bool) $singleton,
            'instance'  => null
        );

        return $this;
    }
768567
public function save($id, $data, $lifetime = null)
    {
        if ($this->enabled) {
            if ($lifetime === null) {
                $lifetime = $this->getLifetime();
            }
            $this->driver->save($id, $data, $lifetime);
        }
    }
366811
private function _writeObjectToDb($object, $id)
    {
        $objectId = (!is_null($id)) ? $id : $this->_generateUniqueId();
        $origin = $this->_getObjectOrigin($objectId);
        $object = json_decode(json_encode($object));
        $object->__id = $objectId;
        $object->__revision = $this->_generateRevisionNumber();
        $object->__updated = $this->_generateTimestamp();
        $object->__origin = ($origin) ? $origin : $object->__updated;

        //insert into database
        $insert = Statement::get(
            'INSERT_OBJECT',
            [
                '@collection' => $this->_name,
                '@id' => $this->_connector->quote($object->__id),
                '@revision' => $this->_connector->quote($object->__revision),
                '@committed' => $this->_connector->quote(0),
                '@updated' => $this->_connector->quote($object->__updated),
                '@origin' => $this->_connector->quote($object->__origin),
                '@obj' => $this->_connector->quote(json_encode($object))
            ]
        );
        $this->_connector->exec($insert);
        return $object;
    }
651352
public static function put($name, $object, $lifetime = null)
    {
        static::isOn(true);

        if (is_null($lifetime)) {
            $lifetime = config('storage.session_lifetime');
        }

        if ($lifetime > 0) {
            $lifetime = time() + $lifetime;
        }

        $item = ['name' => $name, 'object' => $object, 'lifetime' => $lifetime];

        static::$register[$name] = $item;

        static::save();

        return true;
    }
183564
public void update(Object object) {
        try {
            persistenceManager.saveEntity((IManagedEntity) object);
        } catch (InitializationException ignore){}
        catch (Exception e) {
            e.printStackTrace();
        }
    }
1283729
protected function init($id, $file)
    {
        $this->setState(self::RUNNING);
        $this->setId($id);
        $this->setBuffer(array());
        $this->setOutput('');
        $this->setPreviousChar(false);
        $this->setPreviousSignificantChar(false);

        if (($data = @file_get_contents($file)) !== false) {
            $stream = new MemoryStream($data);
            $stream->open();
            $this->setStream($stream);
        } else {
            throw new RenderingException("The CSS file '${file}' could not be open.", RenderingException::RUNTIME);
        }
    }
1259860
public function is_singleton( $id ) {
		if ( ! is_string( $id ) ) {
			throw new InvalidArgumentException( 'Invalid argument. Must be string.' );
		}

		if ( ! $this->bound( $id ) ) {
			return false;
		}

		$id = $this->get_class_prefix( $id );

		return $this->bindings[$id]['singleton'] === true;
	}
1254904
private function initializeEntity($id, $created)
    {
        $this->id = $id ?: $this->generateEntityID();
        $this->created = $created ?: $this->generateCreatedTime();
    }
597906
public function instance(string $key, $object)
    {
        $this->checkKey($key);
        $this->definitions['instance'][$key] = true;
        $this->store[$key] = $object;
    }
223944
public function initialize($id, $alias = null)
    {
        $this->id    = $id;
        $this->alias = $alias;
    }
652146
public function update($id = null) {
        if($id)
            $array = KernelDB::update($this, $this->tuples, static::$model, $id);
        else
            $array = KernelDB::update($this, $this->tuples, static::$model, kernelHttp::request()->getRequiredParameter());

        self::updateThis($this, $array);
    }
257518
public function singleton($name, $object)
    {
        if (IOC::hasSingleton($name)) {
            return IOC::singleton($name);
        } else {
            IOC::singleton($name, $object);
            return $object;
        }
    }