container->set(OAuthStateManager::class, function () { return new OAuthStateManager(); }); $this->container->set(OAuthManager::class, function ($c) { return new OAuthManager($c->get(ConnectionRepositoryInterface::class)); }); $this->container->set(OAuthCallbackController::class, function ($c) { return new OAuthCallbackController( $c->get(OAuthManager::class), $c->get(OAuthStateManager::class), $c->get(ConnectionRepositoryInterface::class) ); }); $this->container->set(SheetsClientInterface::class, function ($c) { return new GoogleSheetsClient( $c->get(OAuthManager::class), $c->get(ConnectionRepositoryInterface::class) ); }); } /** * @inheritDoc */ public function boot(): void { // Hook OAuth Callback endpoint. add_action('admin_post_oneclickformsync_oauth_callback', function () { $this->container->get(OAuthCallbackController::class)->handleCallback(); }); } }