public function getInstance($name, $parameters = [])
	{
		$class = $this->baseNamespace . ucfirst($name);

		// If we have a custom class, use that instead.
		if ( ! empty($this->addedClasses[$name]))
		{
			$class = $this->addedClasses[$name];
		}

		// Ensure our class actually exists
		if ( ! class_exists($class))
		{
			throw new InvalidArgumentException("$name is not a known class ($class)");
		}

		return new $class($parameters);
	}
public function getInstance($name, $parameters = [])
	{
		$class = $this->baseNamespace . ucfirst($name);

		// If we have a custom class, use that instead.
		if ( ! empty($this->addedClasses[$name]))
		{
			$class = $this->addedClasses[$name];
		}

		// Ensure our class actually exists
		if ( ! class_exists($class))
		{
			throw new InvalidArgumentException("$name is not a known class ($class)");
		}

		return new $class($parameters);
	}
public function getInstance ( $ name , $ parameters = [ ] ) { $ class = $ this -> baseNamespace . ucfirst ( $ name ) ; // If we have a custom class, use that instead. if ( ! empty ( $ this -> addedClasses [ $ name ] ) ) { $ class = $ this -> addedClasses [ $ name ] ; } // Ensure our class actually exists if ( ! class_exists ( $ class ) ) { throw new InvalidArgumentException ( "$name is not a known class ($class)" ) ; } return new $ class ( $ parameters ) ; }
Returns a constructed instance of the named class.

@param string $name
@param array  $parameters

@return mixed

@throws InvalidArgumentException If the class cannot be found.
Returns a constructed instance of the named class .