add plugin command bootstrappers

This commit is contained in:
crazywhalecc
2023-03-29 21:31:53 +08:00
committed by Jerry
parent eeb3481c5a
commit 5ac92ae210
4 changed files with 25 additions and 11 deletions

View File

@@ -262,8 +262,17 @@ class Framework
}
}
public function bootstrap(): void
/**
* 执行初始化的函数列表
*
* @param null|string $bootstrapper 要运行的 bootstrapper
*/
public function bootstrap(?string $bootstrapper = null): void
{
if ($bootstrapper !== null) {
(new $bootstrapper())->bootstrap($this->runtime_preferences);
return;
}
foreach ($this->bootstrappers as $bootstrapper) {
/* @var Bootstrapper $bootstrapper */
(new $bootstrapper())->bootstrap($this->runtime_preferences);