getInstance

@param array ...$args

@return static
@throws \ReflectionException
@throws \Windwalker\DI\Exception\DependencyResolutionException
424487
public static function getInstance(...$args)
    {
        $class = static::class;

        if (empty(static::$instances[$class])) {
            static::$instances[$class] = Ioc::getContainer()->newInstance($class, ...$args);
        }

        return static::$instances[$class];
    }
647317
final public static function instance()
        {
            $className = get_called_class();

            if (!Arrays::exists(static::$instances[$className])) {
                static::$instances[$className] = new $className(func_get_args());
            }

            return static::$instances[$className];
        }
1101953
protected static function instanceKey($args = null)
    {
        $class = self::className();

        if (is_array($args))
        {
            $instanceKey = md5(json_encode($args));
        }
        elseif ($args === null)
        {
            $instanceKey = 'default';
        }
        else
        {
            $instanceKey = (string) $args;
        }
        $instanceKey = $class . ':' . $instanceKey;

        return $instanceKey;
    }
563842
public static function getInstance($name, $args = [], $forceNew = false)
    {
        $key = strtolower($name);

        $called = get_called_class();

        if (empty(static::$instances[$called][$key]) || $forceNew) {
            static::$instances[$called][$key] = static::create($name, ...$args);
        }

        return static::$instances[$called][$key];
    }
1291944
final public static function getInstance($config = array())
    {
        static $instance;

        if ($instance === NULL)
        {
            if(!$config instanceof KObjectConfig) {
                $config = new KObjectConfig($config);
            }

            $instance = new self($config);
        }

        return $instance;
    }
238077
public function create($class, array $arguments = [])
    {
        $instanceType = $this->getInstanceType($class);
        $instanceArguments = $this->getInstanceArguments($class, $arguments);
        $reflection = new \ReflectionClass($instanceType);
        $constructor = $reflection->getConstructor();

        if (null === $constructor) {
            $instance = new $instanceType();
        } else {
            $args = $this->resolveArguments($constructor, $instanceArguments);
            $instance = $reflection->newInstanceArgs($args);
        }

        return $instance;
    }
989244
public static function getInstance(array $aliases = array())
	{
		if (is_null(static::$instance)) static::$instance = new static($aliases);
		
		$aliases = array_merge(static::$instance->getAliases(), $aliases);

		static::$instance->setAliases($aliases);

		return static::$instance;
	}
347055
protected function initService(array $args = null) {
		$reflection = $this->getReflection();
		
		if ($args === null) {
			return $reflection->newInstance();
		}
		
		return $reflection->newInstanceArgs($args);
	}
306829
static function instance() {
		if (!Registry::exists($class=get_called_class())) {
			$ref=new Reflectionclass($class);
			$args=func_get_args();
			Registry::set($class,
				$args?$ref->newinstanceargs($args):new $class);
		}
		return Registry::get($class);
	}
517869
public function instantiateClass(string $className, array $args)
    {
        $class = $this->getClass($className);
        $constructor = $class->getConstructor();
        if (empty($constructor)) {
            $instance = $class->newInstanceWithoutConstructor();
        } else {
            $instance = $class->newInstanceArgs($args);
        }
        return $instance;
    }
418868
final public static function getInstance(...$params)
    {
        $called = static::class;
        if (self::$instance instanceof $called) {
            return self::$instance;
        } else {
            return self::$instance = new $called(...$params);
        }
    }
1327223
static function GetInstance()
	{
		if (!self::$IS_INITIALIZED) self::Init();

		if (!self::$INSTANCE instanceof self) self::$INSTANCE = new self;

		return self::$INSTANCE;
	}
1333994
final public static function getInstance()
  {
    $className = get_called_class();
    
    if (!isset(self::$_instances[$className])) {
      self::$_instances[$className] = new static();
    }
    self::$_instances[$className]->initialize();

    return self::$_instances[$className];
  }
671107
public static function load($arg)
    {
        if (is_object($arg) && $arg instanceof Entity) {
            $class = get_class($arg);
        } elseif (is_object($arg) && $arg instanceof Collection) {
            $class = $arg->getEntityClass();
        } elseif (is_object($arg) && $arg instanceof Reflection) {

            $class = $arg->getClassName();
            if (!isset(self::$registered[$class])) {
                return self::$registered[$class] = $arg;
            }
            return $arg;
        } elseif (is_string($arg)) {
            $class = $arg;
        } else {
            throw new Exception\InvalidArgumentException(
                "Entity identifier must be object, collection, class or name!",
                $arg
            );
        }

        if (!is_subclass_of($class, "UniMapper\Entity")) {
            $class = Convention::nameToClass($arg, Convention::ENTITY_MASK);
        }

        if (!class_exists($class)) {
            throw new Exception\InvalidArgumentException(
                "Entity class " . $class . " not found!"
            );
        }

        if (isset(self::$registered[$class])) {
            return self::$registered[$class];
        }

        return self::$registered[$class] = new Reflection($class);
    }
835015
public function singletonFactory($namespace, array $args = [], $name = null)
    {
        if (is_null($name)) {
            $name = $namespace;
        }

        if (!isset($this->singletons[$name])) {
            $this->singletons[$name] = $this->factory($namespace, $args);
        }

        $this->callEvent(
            'register_before_return_singleton',
            [$this->singletons[$name], $args, $name]
        );

        return $this->singletons[$name];
    }
759252
public function create($args)
    {
        $feature = null;
        if (is_object($args)) {
            if ($args instanceof Feature) {
                $feature = $args;
            } else {
                $args = get_object_vars($args);
            }
        } elseif (is_numeric($args)) {
            $args = array($this->getUniqueId() => intval($args));
        }
        return $feature && $feature instanceof Feature ? $feature : new Feature($args, $this->getSrid(), $this->getUniqueId(), $this->getGeomField());
    }
686256
public static function getInstance($config = []){
        if(!(self::$_instance instanceof self)){
            self::$_instance = new self($config);
        }
        return self::$_instance;
    }