diff --git a/Bundle/Bundle.php b/Bundle/Bundle.php index 2baa3a9..6513bc2 100644 --- a/Bundle/Bundle.php +++ b/Bundle/Bundle.php @@ -58,6 +58,10 @@ abstract class Bundle implements BundleContract */ private array $initializedPlugins = []; + private bool $pluginConfigured = false; + + private bool $pluginBooted = false; + public function __construct(protected Application $app) { if ($this instanceof HasPluginInterface) { @@ -207,6 +211,12 @@ public function isDeferred(): bool public function configurePlugin(): void { + if ($this->pluginConfigured) { + return; + } + + $this->pluginConfigured = true; + foreach ($this->initializedPlugins as $plugin) { $plugin->configure(); } @@ -222,6 +232,12 @@ public function configure(): void public function bootPlugin(): void { + if ($this->pluginBooted) { + return; + } + + $this->pluginBooted = true; + foreach ($this->initializedPlugins as $plugin) { $plugin->boot(); }