container = $container; $this->config = $config; } /** * Get an auth provider. * * @return object Default auth provider selected in config if it * does exist. Otherwise the standard db auth * provider. * @throws \RuntimeException If neither the auth provider that * is specified by the phpBB config nor the db * auth provider exist. The db auth provider * should always exist in a phpBB installation. */ public function get_provider() { if ($this->offsetExists('auth.provider.' . basename(trim($this->config['auth_method'])))) { return $this->offsetGet('auth.provider.' . basename(trim($this->config['auth_method']))); } // Revert to db auth provider if selected method does not exist elseif ($this->offsetExists('auth.provider.db')) { return $this->offsetGet('auth.provider.db'); } else { throw new \RuntimeException(sprintf('The authentication provider for the authentication method "%1$s" does not exist. It was not possible to recover from this by reverting to the database authentication provider.', $this->config['auth_method'])); } } }