Get an instance of the class

@return mixed The new class instance
488862
public static function getInstance()
    {
        if (empty(self::$instances[static::class])) {
            $instance = new static();
            self::$instances[static::class] = $instance;
        } else {
            $instance = self::$instances[static::class];
        }
        return ($instance);
    }
760924
public static function getInstance()
    {
        $class = get_called_class();

        if (!isset(self::$instances[$class])) {
            $container = StaticContainer::getContainer();

            $refl = new \ReflectionClass($class);

            if (!$refl->getConstructor() || $refl->getConstructor()->isPublic()) {
                self::$instances[$class] = $container->get($class);
            } else {
                /** @var LoggerInterface $logger */
                $logger = $container->get('Psr\Log\LoggerInterface');

                // BC with API defining a protected constructor
                $logger->notice('The API class {class} defines a protected constructor which is deprecated, make the constructor public instead', array('class' => $class));
                self::$instances[$class] = new $class;
            }
        }

        return self::$instances[$class];
    }
1373535
public static function instance()
    {
        if ( !isset( self::$instance ) )
        {
            $ini = eZINI::instance( 'ezcomments.ini' );
            $className = $ini->variable( 'ManagerClasses', 'CommentManagerClass' );
            self::$instance = new $className();
        }
        return self::$instance;
    }
250673
public function newInstance()
    {
        if (!$this->instantiator instanceof InstantiatorInterface) {
            $this->instantiator = new Instantiator();
        }

        return $this->instantiator->instantiate($this->name);
    }
378259
public static function getInstance()
    {
        if (is_null(self::$instance)) {
            throw new \RuntimeException('You must first create the singleton instance with createInstance().');
        }
        self::$instance->setGlobalsFromSugar();
        self::$instance->chdirToSugarDir();

        return self::$instance;
    }
640454
protected static function getInstance()
    {
        $type = self::getType();
        $appID = App::getCurrentID();
        $complementID = self::getCurrentID();
        $complement = get_called_class();
        if (! isset(self::$instances[$appID][$type][$complementID])) {
            self::$instances[$appID][$type][$complementID] = new $complement();
        }

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

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

        return self::$_aInstances[$sClass];
    }
1257397
private static function instance()
    {
        $currentClass = get_called_class();
        $instanceName = empty( self::$instance ) ? '' : new \ReflectionClass(self::$instance);
        if( empty( self::$instance ) || ( $instanceName->name != $currentClass ) ) {
            self::$instance = new static();
        }
        return self::$instance;
    }
486745
public static function getInstance()
    {
        $class = new ReflectionClass(get_called_class());
        $className = $class->getName();
        if (isset(self::$instances[$className]) === false || $class->isInstance(self::$instances[$className]) === false) {
            self::$instances[$className] = $class->newInstanceWithoutConstructor();

            if (($constructorMethod = $class->getConstructor()) instanceof ReflectionMethod) {
                call_user_func_array(array(self::$instances[$className], '__construct'), func_get_args());

                if ($constructorMethod->isPublic() === true) {
                    trigger_error($className . '::__construct is public and could be instantiated as non-singleton.', E_USER_NOTICE);
                    // @codeCoverageIgnoreStart
                } // @codeCoverageIgnoreEnd
            }
        }

        return self::$instances[$className];
    }
200465
public function load()
    {
        $this->loadChildClasses();

        list($constructorResolvedOptions, $extraResolvedOptions) = $this->resolveOptions();
        $instance = $this->reflected->newInstanceArgs($constructorResolvedOptions);

        $this->loadExtraOptions($extraResolvedOptions, $instance);

        return $instance;
    }
306601
public function getInstance()
    {
        if ($this->isSingleton() && $this->hasInstance()) {
            return $this->instance;
        }

        // require path
        if ($this->path) {
            require_once $this->path;
        }

        // initialize
        if ($this->isClosure()) {
            $closure = $this->class;
            $instance = $closure($this->container);
        } else {
            $class = $this->class;
            if ($class[0] !== '\\') $class = '\\' . $class;
            $script = sprintf('$instance = new %s(%s);', $class, $this->array2ArgsWithInjectDependency('$this->args', $this->args));
            eval($script);
        }

        if ($this->isSingleton()) {
            $this->instance = $instance;
        }
        if ($this->container && method_exists($instance, 'setContainer')) {
            $instance->setContainer($this->container);
        }
        
        // inject dependency
        if ($this->container) {
            $this->container->injectDependency($instance);
        }
        
        // init method
        if ($this->hasInitMethod()) {
            $this->callInitMethod($instance);
        } elseif($this->hasInitializeMethod($instance)) {
            $instance->initialize();
        }

        return $instance;
    }
663322
public static function getInstance()
    {
        if (self::$_instance === null) {
            self::$_instance = oxNew(__CLASS__);
        }

        return self::$_instance;
    }
676030
public static function newInstance()
    {
        $config = self::create();

        $config->username = 'null';
        $config->password = 'null';
        $config->credentials = ['null', 'null'];
        $config->bindtoInterface = 'null';
        $config->timeout = 5;

        return $config;
    }
394891
public function get_current_instance() {
        if ($this->get_status() == self::INSTANCE_STATUS_ACTIVE || $this->get_status() == self::INSTANCE_STATUS_NEEDUPDATE) {
            return $this;
        }
        return $this->get_controller()->get_current_instance($this->data->raterid, $this->data->itemid);
    }
1161919
public static function GetInstance() {
      if (!isset(self::$_Instance)) {
         $c = __CLASS__;
         self::$_Instance = new $c();
      }
      return self::$_Instance;
   }
109975
public static function getInstance()
    {
        if (true === is_null(self::$_instance)) {
            self::$_instance = new self();
            self::$_instance->variables = [];
            self::$_instance->system_errors = [];
            self::$_instance->system_debug = [];
            self::$_instance->variables["config"] = [];
        }

        return self::$_instance;
    }
285831
public function getModelInstance()
    {
        if ($this->instance !== null) {
            return $this->instance;
        }
        $model = $this->getModel();
        if ($model === false) {
            return false;
        }
        $instance = new $model();

        return $instance;
    }