Returns the instance of a class.

@return object
516371
protected function createClass(string $className)
    {
        if (!class_exists($className)) {
            throw new class("The class $className does not exists") extends Exception implements
                NotFoundExceptionInterface {
            };
        }

        $reflection = new ReflectionClass($className);

        if ($reflection->hasMethod('__construct')) {
            return $reflection->newInstanceArgs($this->arguments);
        }

        return $reflection->newInstance();
    }
1139326
public static function getInstance()
    {
        $accesor = static::getAccessor();

        if (!static::$instance instanceof $accesor) {
            static::beforeConstruct();

            $args = static::getArguments();

            static::$instance = static::make($accesor, $args);

            static::afterConstruct();
        }

        return static::$instance;
    }
514480
public static function getInstance(): Request
    {
        if (self::$instance === null) {
            $calledClass    = get_called_class(); //Autorize extends this class
            self::$instance = new $calledClass;
        }

        return self::$instance;
    }
673153
public function getInstance()
	{
		if (!is_null($this->instance)) {
			return $this->instance;
		}

        $this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue);
        $this->instance->job = $this;
        return $this->instance;
	}
1187599
public static function instance($className = __CLASS__)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = new $className;
        }

        return self::$instances[$className];
    }
852730
public static function getInstance()
    {
        $sClass = get_called_class();

        if (!isset(self::$_aInstances[$sClass])) {
            self::$_aInstances[$sClass] = new $sClass();
        }

        return self::$_aInstances[$sClass];
    }
285001
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                MockFactory::instance(),
                HandleFactory::instance(),
                InvocableInspector::instance()
            );
        }

        return self::$instance;
    }
1321202
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                Sequencer::sequence('mock-class-label'),
                FunctionSignatureInspector::instance(),
                FeatureDetector::instance()
            );
        }

        return self::$instance;
    }
373848
public function instance()
    {
        $settings = $this->getValidatedSettings();

        $objectManager = $this->createObjectManager($settings);
        $logger = isset($settings['logger']) ? isset($settings['logger']) : null;

        $this->initializeRegistry($objectManager, $logger);

        return new DataMapper($objectManager);
    }
599800
public static function getInstance()
	{
		if ( is_null( self::$instance ) )
		{
			self::$instance = new self();
			self::$instance->createLog( 'error_log', PEAR_LOG_TYPE_SYSTEM, 'xpath2_log',
				array(
					'lineFormat' => '[%{priority}] %{message}',
				)
			);

		}

		return self::$instance;
	}
147595
protected function instance($class)
    {
        $reflection = new \ReflectionClass($class);

        $arguments = array();

        $constructor = $reflection->getConstructor();

        if ($this->container->has($class))
        {
            return $this->container->get($class);
        }

        if ($constructor !== null)
        {
            $arguments = $this->arguments($constructor);
        }

        return $reflection->newInstanceArgs($arguments);
    }
1162234
public static function getInstance()
    {
        // set strict to false
        // -> meaning: no matter which parameter given we return the same instance
        self::$strict = false;

        // get possible parameter passed to this class
        $arguments = func_get_args();

        // decide call-type by given parameter
        if (empty($arguments)) {
            $instance = parent::getInstance();
        } else {
            $instance = parent::getInstance($arguments);
        }

        // return instance
        return $instance;
    }
1158492
public static function getInstance($className)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = new self($className);
        }

        return self::$instances[$className];
    }
882762
public static function singleton() {
        $returnValue = null;

        
        $serviceName = get_called_class();
        if (!isset(self::$instances[$serviceName])) {
            self::$instances[$serviceName] = new $serviceName();
        }

        $returnValue = self::$instances[$serviceName];
        

        return $returnValue;
    }
1297326
public static function getInstance()
    {
        if ( self::$instance === null ) {
            self::$instance = new Config( self::$file );
        }
        
        return self::$instance;
    }
1349128
static function instance($class = null) {
        if (!$class) {
            $class = get_called_class();
        }
        if (!is_a($class, ValidateBuilder::class, true)) {
            throw new \Exception($class . ' is not a subclass of ' . ValidateBuilder::class);
        }
        if (!isset(self::$instances[$class])) {
            self::$instances[$class] = new $class;
        }

        return self::$instances[$class];
    }
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];
  }