WP_CLI\Bootstrap
AutoloaderStep::process
Process this single bootstrapping step.
Method of the class: AutoloaderStep{}
No Hooks.
Returns
BootstrapState. Modified state to pass to the next step.
Usage
$AutoloaderStep = new AutoloaderStep(); $AutoloaderStep->process( $state );
- $state(BootstrapState) (required)
- Contextual state to pass into the step.
AutoloaderStep::process() AutoloaderStep::process code WP-CLI 2.13.0-alpha
public function process( BootstrapState $state ) {
$this->state = $state;
$found_autoloader = false;
$autoloader_paths = $this->get_autoloader_paths();
if ( false === $autoloader_paths ) {
// Skip this autoload step.
return $state;
}
foreach ( $autoloader_paths as $autoloader_path ) {
if ( is_readable( $autoloader_path ) ) {
try {
WP_CLI::debug(
sprintf(
'Loading detected autoloader: %s',
$autoloader_path
),
'bootstrap'
);
require $autoloader_path;
$found_autoloader = true;
} catch ( Exception $exception ) {
WP_CLI::warning(
"Failed to load autoloader '{$autoloader_path}'. Reason: "
. $exception->getMessage()
);
}
}
}
if ( ! $found_autoloader ) {
$this->handle_failure();
}
return $this->state;
}