Make a singleton binding closure method to store in the cache.

@param  string $id
@param  mixed $blueprint
@param  array $dependencies
@return Closure
540193
private function prepareSingletonBindingClosure($id, $blueprint, $dependencies): Closure
    {
        $binding = $this->bindings[$id];
        $instance = $blueprint;

        if ($blueprint instanceof ReflectionClass) {
            foreach ($dependencies as $key => $dependency) {
                if ($dependency instanceof Closure) {
                    $dependencies[$key] = $dependency();
                }
            }
            $instance = $blueprint->newInstanceArgs($dependencies);
        }
        if ($blueprint instanceof Closure) {
            $instance = $blueprint();
        }
        // If blueprint is supplied as a class name.
        if (is_string($blueprint)) {
            $instance = new $blueprint;
        }
        // Singletons won't need these any longer so free up the memory.
        unset($binding['dependencies'], $binding['reflector']);

        return $this->cache[$id] = function () use ($instance) {
            return $instance;
        };
    }
1099103
public function meet($blueprint)
    {
        $parts = explode('.', $this->dependency);

        return $this->get($parts, $blueprint);
    }
520347
public static function one(PDFfiller $provider, $id)
    {
        $params = static::query($provider, $id);
        $instance = new static($provider, array_merge($params, ['exists' => true]));
        $instance->cacheFields($params);

        return $instance;
    }
1229122
public function compileAdd(Blueprint $blueprint, Fluent $command)
    {
        $columns = $this->prefixArray('add column', $this->getColumns($blueprint));

        return collect($columns)->map(function ($column) use ($blueprint) {
            return 'alter table '.$this->wrapTable($blueprint).' '.$column;
        })->all();
    }
1323373
protected function createBlueprint($table, Closure $callback = null)
    {
        $prefix = $this->connection->getConfig('prefix_indexes')
                    ? $this->connection->getConfig('prefix')
                    : '';

        if (isset($this->resolver)) {
            return call_user_func($this->resolver, $table, $callback, $prefix);
        }

        return new Blueprint($table, $callback, $prefix);
    }
1253157
protected function modifySrid(Blueprint $blueprint, Fluent $column)
    {
        if (! is_null($column->srid) && is_int($column->srid) && $column->srid > 0) {
            return ' srid '.$column->srid;
        }
    }
1046589
public function compileCreate(Blueprint $blueprint, Fluent $command)
	{
		$columns = implode(', ', $this->getColumns($blueprint));

		$sql = $blueprint->temporary ? 'create temporary' : 'create';

		$sql .= ' table '.$this->wrapTable($blueprint)." ($columns)";

		return $sql;
	}
919156
public function compileDrop(Blueprint $blueprint, Fluent $command)
    {
        $match = $this->compileFrom($blueprint);
        $label = $this->prepareLabels(array($blueprint));

        return $match . " REMOVE n" . $label;
    }
710191
public static function getInstance($dependencyName, array $loadedDependencies)
    {
        $k = $dependencyName . '_' . implode('_', $loadedDependencies);
        if (!isset(self::$_instances[$k])) {
            self::$_instances[$k] = new self(Kwf_Assets_Package_Default::getDefaultProviderList(), $dependencyName, $loadedDependencies);
        }
        return self::$_instances[$k];
    }
546908
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        $fields = $blueprint->getFields();

        $statement = $this->compileFields($fields);

        return $statement;
    }
55862
public function singleton($id, callable $resolver)
    {
        $this->innerSet($id, $resolver);
        unset($this->resolved[$id]);
        $this->singletons[$id] = true;
        return $this;
    }
123150
public function compileDropUnique(Blueprint $blueprint, Fluent $command)
    {
        $index = $this->wrap($command->index);

        return "alter table {$this->wrapTable($blueprint)} drop index {$index}";
    }
1200207
public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
	{
		$table = $blueprint->getTable();

		$index = $this->wrap("{$table}_pkey");

		return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$index}";
	}
902673
protected static function getOrInit($id, Closure $closure)
  {
    if (!self::has($id)) {
      self::set($id, $closure());
    }

    return self::get($id);
  }
114450
private function storeComponentDependencies(string $key, array $componentConfig, string $id)
    {
        foreach ($this->factory->getDependencies($key) as $dependencyKey => $componentMethod) {
            $componentConfig[$dependencyKey] = (array)($componentConfig[$dependencyKey] ?? []);
            foreach ($componentConfig[$dependencyKey] as $componentId) {
                $this->storage[$id]['calls'][] = [
                    $componentMethod,
                    ['@' . $this->resolveStorageId($dependencyKey, $componentId)],
                ];
            }
        }
    }
1071331
protected function loadDependencyInObject($object, $property, $dependencyName, $dependencyDefinition){
        $dependency= $this->loadDependency($dependencyName, $dependencyDefinition);
        $reflection= new Reflection($object);
        $reflection->setProperty($property, $dependency, TRUE);
    }
694448
public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
    {
        return RenameColumn::compile($this, $blueprint, $command, $connection);
    }