public function newInstance($className, $namespace = 'FuzeWorks\\'): self
	{
		// Determine the class to load
		$instanceName = strtolower($className);
		$className = $namespace.ucfirst($className);

		if (!isset($this->{$instanceName}))
		{
			throw new FactoryException("Could not load new instance of '".$instanceName."'. Instance was not found.", 1);
		}
		elseif (!class_exists($className, false))
		{
			throw new FactoryException("Could not load new instance of '".$instanceName."'. Class not found.", 1);
		}

		// Remove the current instance
		unset($this->{$instanceName});

		// And set the new one
		$this->{$instanceName} = new $className();

		// Return itself
		return $this;
	}
public function newInstance($className, $namespace = 'FuzeWorks\\'): self
	{
		// Determine the class to load
		$instanceName = strtolower($className);
		$className = $namespace.ucfirst($className);

		if (!isset($this->{$instanceName}))
		{
			throw new FactoryException("Could not load new instance of '".$instanceName."'. Instance was not found.", 1);
		}
		elseif (!class_exists($className, false))
		{
			throw new FactoryException("Could not load new instance of '".$instanceName."'. Class not found.", 1);
		}

		// Remove the current instance
		unset($this->{$instanceName});

		// And set the new one
		$this->{$instanceName} = new $className();

		// Return itself
		return $this;
	}
public function newInstance ( $ className , $ namespace = 'FuzeWorks\\' ) : self { // Determine the class to load $ instanceName = strtolower ( $ className ) ; $ className = $ namespace . ucfirst ( $ className ) ; if ( ! isset ( $ this -> { $ instanceName } ) ) { throw new FactoryException ( "Could not load new instance of '" . $ instanceName . "'. Instance was not found." , 1 ) ; } elseif ( ! class_exists ( $ className , false ) ) { throw new FactoryException ( "Could not load new instance of '" . $ instanceName . "'. Class not found." , 1 ) ; } // Remove the current instance unset ( $ this -> { $ instanceName } ) ; // And set the new one $ this -> { $ instanceName } = new $ className ( ) ; // Return itself return $ this ; }
Create a new instance of one of the loaded classes.
It reloads the class. It does NOT clone it.

@param string $className The name of the loaded class, WITHOUT the namespace
@param string $namespace Optional namespace. Defaults to 'FuzeWorks\'
@return Factory Instance
Create a new instance of one of the loaded classes . It reloads the class . It does NOT clone it .