isExt(".csv")) $class = CsvBuilder::class; else $class = static::class; return new $class($builder->name); } if (is_string($builder)) $builder = ["output" => $builder]; if (!is_array($builder)) { throw ValueException::invalid_type($builder, self::class); } $input = $builder["output"] ?? null; if (is_string($input) && path::ext($input) === ".csv") { $class = CsvBuilder::class; } if ($class === null) $class = static::class; return new $class(null, $builder); } }