WP_CLI\Bootstrap
IncludePackageAutoloader::get_autoloader_paths
Get the autoloader paths to scan for an autoloader.
Method of the class: IncludePackageAutoloader{}
No Hooks.
Returns
String[]|false. Array of strings with autoloader paths, or false to skip.
Usage
// protected - for code of main (parent) or child class $result = $this->get_autoloader_paths();
IncludePackageAutoloader::get_autoloader_paths() IncludePackageAutoloader::get autoloader paths code WP-CLI 2.13.0-alpha
protected function get_autoloader_paths() {
if ( $this->state->getValue( BootstrapState::IS_PROTECTED_COMMAND, false ) ) {
return false;
}
$runner = new RunnerInstance();
$skip_packages = $runner()->config['skip-packages'];
if ( true === $skip_packages ) {
WP_CLI::debug( 'Skipped loading packages.', 'bootstrap' );
return false;
}
$autoloader_path = $runner()->get_packages_dir_path() . 'vendor/autoload.php';
if ( is_readable( $autoloader_path ) ) {
WP_CLI::debug(
'Loading packages from: ' . $autoloader_path,
'bootstrap'
);
return [
$autoloader_path,
];
}
return false;
}