public function setClassName($name, $class_name, $shared = true) {
		if (substr($name, -1) === '_') {
			throw new InvalidArgumentException('$name cannot end with "_"');
		}
		$classname_pattern = self::CLASS_NAME_PATTERN_53;
		if (!is_string($class_name) || !preg_match($classname_pattern, $class_name)) {
			throw new InvalidArgumentException('Class names must be valid PHP class names');
		}
		$func = function () use ($class_name) {
			return new $class_name();
		};
		return $this->setFactory($name, $func, $shared);
	}
public function setClassName($name, $class_name, $shared = true) {
		if (substr($name, -1) === '_') {
			throw new InvalidArgumentException('$name cannot end with "_"');
		}
		$classname_pattern = self::CLASS_NAME_PATTERN_53;
		if (!is_string($class_name) || !preg_match($classname_pattern, $class_name)) {
			throw new InvalidArgumentException('Class names must be valid PHP class names');
		}
		$func = function () use ($class_name) {
			return new $class_name();
		};
		return $this->setFactory($name, $func, $shared);
	}
public function setClassName ( $ name , $ class_name , $ shared = true ) { if ( substr ( $ name , - 1 ) === '_' ) { throw new InvalidArgumentException ( '$name cannot end with "_"' ) ; } $ classname_pattern = self :: CLASS_NAME_PATTERN_53 ; if ( ! is_string ( $ class_name ) || ! preg_match ( $ classname_pattern , $ class_name ) ) { throw new InvalidArgumentException ( 'Class names must be valid PHP class names' ) ; } $ func = function ( ) use ( $ class_name ) { return new $ class_name ( ) ; } ; return $ this -> setFactory ( $ name , $ func , $ shared ) ; }
Set a factory based on instantiating a class with no arguments.

@param string $name       Name of the value
@param string $class_name Class name to be instantiated
@param bool   $shared     Whether the same value should be returned for every request
@return \Elgg\Di\DiContainer
@throws InvalidArgumentException
Set a factory based on instantiating a class with no arguments .