Get the project instance.

@return \Droath\ProjectX\Project\ProjectTypeInterface
@throws \Exception
@throws \Psr\Container\ContainerExceptionInterface
@throws \Psr\Container\NotFoundExceptionInterface
354893
protected function getProjectInstance()
    {
        $project = ProjectX::getProjectType();

        if (!$project instanceof PhpProjectType) {
            throw new \Exception(
                'These tasks can only be ran for PHP based projects.'
            );
        }
        $project->setBuilder($this->getBuilder());

        return $project;
    }
626880
public static function getInstance()
    {
        if (null === self::$instance) {
            self::$instance = new static();

            $loader = new YamlFileLoader(self::$instance, new FileLocator(__DIR__.'/../Resources/config'));
            $loader->load('config.yml');
            $loader->load('services.yml');

            self::$instance->setParameter('phantomjs.cache_dir', sys_get_temp_dir());
            self::$instance->setParameter('phantomjs.resource_dir', __DIR__.'/../Resources');
        }

        return self::$instance;
    }
966207
public function build(): InspectWorkerRequest
	{
		$instance = new InspectWorkerRequest();
		if ($this->versionId === null) {
			throw new BuilderException('Property [versionId] is required.');
		}
		$instance->versionId = $this->versionId;
		return $instance;
	}
587039
public static function getContainer() : ?ContainerInterface
    {
        if (is_null(self::$container)) {
            self::setContainer(self::getDefaultContainer());
        }

        return self::$container;
    }
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];
    }
344489
public static function getInstance()
    {
        if (null === self::$instance) {
            $class          = new \ReflectionClass(__CLASS__);
            self::$instance = $class->newInstanceArgs(func_get_args());
        }

        return self::$instance;
    }
1027935
protected function iocContainer()
    {
        if (
            property_exists($this, 'container')
            && isset($this->container)
            && $this->container instanceof ContainerInterface
        ) {
            return $this->container;
        }

        /*
         * Technically your code can work without ever being using fallback container, all
         * spiral components can do that and only few traits will require few extra parameters.
         *
         * I'm planning one day (update: DONE) to run spiral as worker and later in async mode (few app
         * processes in memory), memory schemas might help a lot by minimizing runtime code by using
         * pre-calculated behaviours.
         */

        return self::$staticContainer;
    }
666271
final public static function getInstance()
    {
        $cls = static::class;
        if (isset(static::$instances[$cls])) {
            return static::$instances[$cls];
        }

        if ($cls === self::class) {
            throw new \LogicException("$cls cannot be used directly. Please subclass in your project.");
        }

        return static::$instances[$cls] = static::create();
    }
1267473
public function getProjectManager()
    {
        if (null === $this->projectManager) {
            $this->projectManager = new ProjectManager($this->httpClient, $this->messageFactory, $this->serializer);
            $this->projectManager->setHost($this->host);
        }
        return $this->projectManager;
    }
500273
public static function getInstance(  ) { 
            
        if(!self::$objInstance){ 
            self::$options = array(
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
            );
            
            self::$objInstance = new PDO(PDOLITE_DB_DSN, PDOLITE_DB_USER, PDOLITE_DB_PASS, self::$options); 
        } 
        
        return self::$objInstance; 
    }
227496
public function getContainer()
    {
        if (!$this->container) {
            $package = $this->getPackage();

            $this->container = $package->getContainer() ?: Ioc::factory();
        }

        return $this->container;
    }
937377
public static function instance()
    {
        if ( self::$instance === null )
        {
            $serviceContainer = ezpKernel::instance()->getServiceContainer();
            self::$instance = new self( $serviceContainer->get( 'ezpublish.api.repository' ) );
        }

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

        if(!class_exists($this->payload['class'])) {
            throw new Exception(
                'Could not find job class ' . $this->payload['class'] . '.'
            );
        }

        if(!method_exists($this->payload['class'], 'perform')) {
            throw new Exception(
                'Job class ' . $this->payload['class'] . ' does not contain a perform method.'
            );
        }

        $this->instance = new $this->payload['class']();
        $this->instance->job = $this;
        $this->instance->args = $this->getArguments();
        $this->instance->queue = $this->queue;
        return $this->instance;
    }
230585
public function getInstance() {
        if(!$this->isInstanceLoaded()) {
            $inst = $this->loadInstance();
            if(!$this->instance)
                $this->instance = $inst;
        }
		return $this->instance;
	}
683640
public function getRepository()
    {
        if (!$this->started) {
            throw new LogicException('Puli was not started');
        }

        if (!$this->context instanceof ProjectContext) {
            return null;
        }

        if (!$this->repo) {
            $this->repo = $this->getFactory()->createRepository();
        }

        return $this->repo;
    }
546333
public static function getInstance()
    {
        $self = get_called_class();
        if (!isset(self::$instances[$self])) {
            self::$instances[$self] = new $self;
        }
        return self::$instances[$self];
    }
427122
public static function getInstance()
	{
		if ( is_null( self::$instance ) )
		{
			self::$instance = new self();
			self::$instance->types = XBRL_Types::getInstance();
		}
		return self::$instance;
	}