WP_CLI

Autoloader::add_namespace()publicWP-CLI 1.0

Add a specific namespace structure with our custom autoloader.

Method of the class: Autoloader{}

No Hooks.

Return

self.

Usage

$Autoloader = new Autoloader();
$Autoloader->add_namespace(;

Autoloader::add_namespace() code WP-CLI 2.8.0-alpha

public function add_namespace(
	$root,
	$base_dir,
	$prefix = '',
	$suffix = '.php',
	$lowercase = false,
	$underscores = false
) {
	$this->namespaces[] = [
		'root'        => $this->normalize_root( (string) $root ),
		'base_dir'    => $this->add_trailing_slash( (string) $base_dir ),
		'prefix'      => (string) $prefix,
		'suffix'      => (string) $suffix,
		'lowercase'   => (bool) $lowercase,
		'underscores' => (bool) $underscores,
	];

	return $this;
}