WP_CLI\Bootstrap
RegisterFrameworkCommands::process
Process this single bootstrapping step.
Метод класса: RegisterFrameworkCommands{}
Хуков нет.
Возвращает
BootstrapState. Modified state to pass to the next step.
Использование
$RegisterFrameworkCommands = new RegisterFrameworkCommands(); $RegisterFrameworkCommands->process( $state );
- $state(BootstrapState) (обязательный)
- Contextual state to pass into the step.
Код RegisterFrameworkCommands::process() RegisterFrameworkCommands::process WP-CLI 2.13.0-alpha
public function process( BootstrapState $state ) {
$cmd_dir = WP_CLI_ROOT . '/php/commands';
$iterator = new DirectoryIterator( $cmd_dir );
foreach ( $iterator as $filename ) {
if ( '.php' !== substr( $filename, - 4 ) ) {
continue;
}
try {
WP_CLI::debug(
sprintf(
'Adding framework command: %s',
"$cmd_dir/$filename"
),
'bootstrap'
);
include_once "$cmd_dir/$filename";
} catch ( Exception $exception ) {
WP_CLI::warning(
"Could not add command {$cmd_dir}/{$filename}. Reason: " . $exception->getMessage()
);
}
}
return $state;
}