loadConfig(); * echo $config['yourConfigurationKey']; * * @return mixed[] * * @throws InvalidPluginRootPathException * @throws JsonException */ public function loadConfig(): array { if (! $this->config) { $this->updateConfig(); } return $this->config; } /** * Refreshes the cached plugin configuration held in this class. * * Example usage: * * $pluginConfigManager = new PluginConfigManager(); * $config = $pluginConfigManager->loadConfig(); * * // ... long operation ... * // ... long operation ... * // ... long operation ... * * $pluginConfigManager->updateConfig(); * // config is now up to date * $config = $pluginConfigManager->loadConfig(); * * @throws InvalidPluginRootPathException * @throws JsonException */ public function updateConfig(): void { $this->config = $this->getDataFromJson(self::CONFIG_JSON); } }