original_string: public static function newInstance($class) {
  		$className = str_replace(':', '\\', $class);
  		$reflectedClass = new ReflectionClass($className);
  
  		if ($reflectedClass->isInstantiable()) {
  			$constructor = $reflectedClass->getConstructor();
  
  			if ($constructor) {
  				$parameters = $constructor->getParameters();
  				$constructorParameters = array();
  
  				foreach ($parameters as $parameter) {
  					if ($parameter->getClass()) {
  						$constructorParameters[] = self::newInstance($parameter->getClass()->getName());
  					} else {
  						$constructorParameters[] = $parameter->getDefaultValue();
  					}
  				}
  
  				return $reflectedClass->newInstanceArgs($constructorParameters);
  			} else {
  				return $reflectedClass->newInstance();
  			}
  
  		} else {
  			throw new Exception($class." is not instantiable Class");
  		}
  	}
code: public static function newInstance($class) {
  		$className = str_replace(':', '\\', $class);
  		$reflectedClass = new ReflectionClass($className);
  
  		if ($reflectedClass->isInstantiable()) {
  			$constructor = $reflectedClass->getConstructor();
  
  			if ($constructor) {
  				$parameters = $constructor->getParameters();
  				$constructorParameters = array();
  
  				foreach ($parameters as $parameter) {
  					if ($parameter->getClass()) {
  						$constructorParameters[] = self::newInstance($parameter->getClass()->getName());
  					} else {
  						$constructorParameters[] = $parameter->getDefaultValue();
  					}
  				}
  
  				return $reflectedClass->newInstanceArgs($constructorParameters);
  			} else {
  				return $reflectedClass->newInstance();
  			}
  
  		} else {
  			throw new Exception($class." is not instantiable Class");
  		}
  	}
code_tokens: public static function newInstance ( $ class ) { $ className = str_replace ( ':' , '\\' , $ class ) ; $ reflectedClass = new ReflectionClass ( $ className ) ; if ( $ reflectedClass -> isInstantiable ( ) ) { $ constructor = $ reflectedClass -> getConstructor ( ) ; if ( $ constructor ) { $ parameters = $ constructor -> getParameters ( ) ; $ constructorParameters = array ( ) ; foreach ( $ parameters as $ parameter ) { if ( $ parameter -> getClass ( ) ) { $ constructorParameters [ ] = self :: newInstance ( $ parameter -> getClass ( ) -> getName ( ) ) ; } else { $ constructorParameters [ ] = $ parameter -> getDefaultValue ( ) ; } } return $ reflectedClass -> newInstanceArgs ( $ constructorParameters ) ; } else { return $ reflectedClass -> newInstance ( ) ; } } else { throw new Exception ( $ class . " is not instantiable Class" ) ; } }
docstring: An instance factory method
  
  @param string $class Full class name with used : as namespace separator
  
  @return mixed
docstring_tokens: An instance factory method