WP_CLI\Bootstrap

AutoloaderStep::process()publicWP-CLI 1.0

Process this single bootstrapping step.

Метод класса: AutoloaderStep{}

Хуков нет.

Возвращает

BootstrapState. Modified state to pass to the next step.

Использование

$AutoloaderStep = new AutoloaderStep();
$AutoloaderStep->process( $state );
$state(BootstrapState) (обязательный)
Contextual state to pass into the step.

Код AutoloaderStep::process() WP-CLI 2.8.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 autoloading 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;
}