ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/go/pkg/mod/github.com/go-openapi/[email protected]/options.go
package loads

type options struct {
	loader *loader
}

func defaultOptions() *options {
	return &options{
		loader: loaders,
	}
}

func loaderFromOptions(options []LoaderOption) *loader {
	opts := defaultOptions()
	for _, apply := range options {
		apply(opts)
	}

	return opts.loader
}

// LoaderOption allows to fine-tune the spec loader behavior
type LoaderOption func(*options)

// WithDocLoader sets a custom loader for loading specs
func WithDocLoader(l DocLoader) LoaderOption {
	return func(opt *options) {
		if l == nil {
			return
		}
		opt.loader = &loader{
			DocLoaderWithMatch: DocLoaderWithMatch{
				Fn: l,
			},
		}
	}
}

// WithDocLoaderMatches sets a chain of custom loaders for loading specs
// for different extension matches.
//
// Loaders are executed in the order of provided DocLoaderWithMatch'es.
func WithDocLoaderMatches(l ...DocLoaderWithMatch) LoaderOption {
	return func(opt *options) {
		var final, prev *loader
		for _, ldr := range l {
			if ldr.Fn == nil {
				continue
			}

			if prev == nil {
				final = &loader{DocLoaderWithMatch: ldr}
				prev = final
				continue
			}

			prev = prev.WithNext(&loader{DocLoaderWithMatch: ldr})
		}
		opt.loader = final
	}
}