src/mako/syringe/Container.php
public function get(string $class, array $parameters = [], bool $reuseInstance = true): object
	{
		$class = $this->resolveAlias($class);

		// If a singleton instance exists then we'll just return it

		if($reuseInstance && isset($this->instances[$class]))
		{
			return $this->instances[$class];
		}

		// Create new instance

		$instance = $this->factory($this->resolveHint($class), $parameters);

		// Store the instance if its registered as a singleton

		if($reuseInstance && isset($this->hints[$class]) && $this->hints[$class]['singleton'])
		{
			$this->instances[$class] = $instance;
		}

		// Return the instance

		return $instance;
	}
public function get(string $class, array $parameters = [], bool $reuseInstance = true): object
	{
		$class = $this->resolveAlias($class);

		// If a singleton instance exists then we'll just return it

		if($reuseInstance && isset($this->instances[$class]))
		{
			return $this->instances[$class];
		}

		// Create new instance

		$instance = $this->factory($this->resolveHint($class), $parameters);

		// Store the instance if its registered as a singleton

		if($reuseInstance && isset($this->hints[$class]) && $this->hints[$class]['singleton'])
		{
			$this->instances[$class] = $instance;
		}

		// Return the instance

		return $instance;
	}
public function get ( string $ class , array $ parameters = [ ] , bool $ reuseInstance = true ) : object { $ class = $ this -> resolveAlias ( $ class ) ; // If a singleton instance exists then we'll just return it if ( $ reuseInstance && isset ( $ this -> instances [ $ class ] ) ) { return $ this -> instances [ $ class ] ; } // Create new instance $ instance = $ this -> factory ( $ this -> resolveHint ( $ class ) , $ parameters ) ; // Store the instance if its registered as a singleton if ( $ reuseInstance && isset ( $ this -> hints [ $ class ] ) && $ this -> hints [ $ class ] [ 'singleton' ] ) { $ this -> instances [ $ class ] = $ instance ; } // Return the instance return $ instance ; }
Returns a class instance.

@param  string $class         Class name
@param  array  $parameters    Constructor parameters
@param  bool   $reuseInstance Reuse existing instance?
@return object
Returns a class instance .