container = new Container(); $this->providers = array( new CoreServiceProvider(), new AssetServiceProvider(), new RenderServiceProvider(), new RestServiceProvider(), new AdminServiceProvider(), ); } /** * Boots the plugin on the plugins_loaded hook. * * @return void */ public function boot(): void { // 1. Bind services into the container. foreach ( $this->providers as $provider ) { $provider->register( $this->container ); } // 2. Resolve services and wire hooks. foreach ( $this->providers as $provider ) { $provider->boot( $this->container ); } // 3. Commit all queued WordPress hooks. $this->container->get( HookLoader::class )->register(); } /** * Returns the service container. * * @return Container */ public function container(): Container { return $this->container; } }