WP_CLI\Bootstrap
InitializeContexts::process()
Process this single bootstrapping step.
Method of the class: InitializeContexts{}
No Hooks.
Return
BootstrapState
. Modified state to pass to the next step.
Usage
$InitializeContexts = new InitializeContexts(); $InitializeContexts->process( $state );
- $state(BootstrapState) (required)
- Contextual state to pass into the step.
InitializeContexts::process() InitializeContexts::process code WP-CLI 2.8.0-alpha
public function process( BootstrapState $state ) { $context_manager = new ContextManager(); $contexts = [ Context::CLI => new Context\Cli(), Context::ADMIN => new Context\Admin(), Context::FRONTEND => new Context\Frontend(), Context::AUTO => new Context\Auto( $context_manager ), ]; $contexts = WP_CLI::do_hook( 'before_registering_contexts', $contexts ); foreach ( $contexts as $name => $implementation ) { $context_manager->register_context( $name, $implementation ); } $state->setValue( 'context_manager', $context_manager ); return $state; }