src/eMacros/Runtime/Builder/InstanceBuilder.php
public function apply(Scope $scope, GenericList $arguments) {
		if (count($arguments) == 0) throw new \BadFunctionCallException("InstanceBuilder: No arguments found.");
		$class = $arguments[0]->evaluate($scope);
		if (!is_string($class))
			throw new \InvalidArgumentException(sprintf("InstanceBuilder: Expected string as first argument but %s was found instead.", gettype($class)));
		//get additional arguments
		$list = array_slice($arguments->getArrayCopy(), 1);
		$args = [];
		//build constructor parameters
		foreach ($list as $el)
			$args[] = $el->evaluate($scope);
		$rc = new \ReflectionClass($class);
		return empty($args) ? $rc->newInstance() : $rc->newInstanceArgs($args);
	}
public function apply(Scope $scope, GenericList $arguments) {
		if (count($arguments) == 0) throw new \BadFunctionCallException("InstanceBuilder: No arguments found.");
		$class = $arguments[0]->evaluate($scope);
		if (!is_string($class))
			throw new \InvalidArgumentException(sprintf("InstanceBuilder: Expected string as first argument but %s was found instead.", gettype($class)));
		//get additional arguments
		$list = array_slice($arguments->getArrayCopy(), 1);
		$args = [];
		//build constructor parameters
		foreach ($list as $el)
			$args[] = $el->evaluate($scope);
		$rc = new \ReflectionClass($class);
		return empty($args) ? $rc->newInstance() : $rc->newInstanceArgs($args);
	}
Creates a new instance from a string
Usage: (instance _class (array 1 2 3))
Returns: object
(non-PHPdoc)
@see \eMacros\Applicable::apply()