public function createFactory($path = null, $className = null)
{
Assert::nullOrStringNotEmpty($path, 'The path to the generated factory file must be a non-empty string or null. Got: %s');
Assert::nullOrStringNotEmpty($className, 'The class name of the generated factory must be a non-empty string or null. Got: %s');
$this->refreshFactoryClass($path, $className);
$className = $className ?: $this->config->get(Config::FACTORY_IN_CLASS);
$path = $path ?: $this->config->get(Config::FACTORY_IN_FILE);
if (null !== $path && !class_exists($className, false)) {
require_once Path::makeAbsolute($path, $this->rootDir);
}
return new $className();
}