WP_CLI\Bootstrap
LoadExecCommand{}└─ BootstrapStep
Class LoadExtraCommand.
Loads a command that was passed through the --exec=<php-code> option.
Хуков нет.
Использование
$LoadExecCommand = new LoadExecCommand(); // use class methods
Методы
Заметки
- Пакет: WP_CLI\Bootstrap
Код LoadExecCommand{} LoadExecCommand{} WP-CLI 2.13.0-alpha
final class LoadExecCommand implements BootstrapStep {
/**
* Process this single bootstrapping step.
*
* @param BootstrapState $state Contextual state to pass into the step.
*
* @return BootstrapState Modified state to pass to the next step.
*/
public function process( BootstrapState $state ) {
if ( $state->getValue( BootstrapState::IS_PROTECTED_COMMAND, false ) ) {
return $state;
}
$runner = new RunnerInstance();
if ( ! isset( $runner()->config['exec'] ) ) {
return $state;
}
foreach ( $runner()->config['exec'] as $php_code ) {
eval( $php_code ); // phpcs:ignore Squiz.PHP.Eval.Discouraged
}
return $state;
}
}