src/mako/syringe/Container.php
public function factory($class, array $parameters = []): object
	{
		// Instantiate class

		if($class instanceof Closure)
		{
			$instance = $this->closureFactory($class, $parameters);
		}
		else
		{
			$instance = $this->reflectionFactory($class, $parameters);
		}

		// Inject container using setter if the class is container aware

		if($this->isContainerAware($instance))
		{
			$instance->setContainer($this);
		}

		// Return the instance

		return $instance;
	}
public function factory($class, array $parameters = []): object
	{
		// Instantiate class

		if($class instanceof Closure)
		{
			$instance = $this->closureFactory($class, $parameters);
		}
		else
		{
			$instance = $this->reflectionFactory($class, $parameters);
		}

		// Inject container using setter if the class is container aware

		if($this->isContainerAware($instance))
		{
			$instance->setContainer($this);
		}

		// Return the instance

		return $instance;
	}
public function factory ( $ class , array $ parameters = [ ] ) : object { // Instantiate class if ( $ class instanceof Closure ) { $ instance = $ this -> closureFactory ( $ class , $ parameters ) ; } else { $ instance = $ this -> reflectionFactory ( $ class , $ parameters ) ; } // Inject container using setter if the class is container aware if ( $ this -> isContainerAware ( $ instance ) ) { $ instance -> setContainer ( $ this ) ; } // Return the instance return $ instance ; }
Creates a class instance.

@param  string|\Closure $class      Class name or closure
@param  array           $parameters Constructor parameters
@return object
Creates a class instance .