scopeConfig = $scopeConfig; $this->encryptor = $encryptor; $this->resourceConfig = $resourceConfig; } /** * Returns module's enabled status * * @return bool */ public function isNewRelicEnabled() { return $this->scopeConfig->isSetFlag('newrelicreporting/general/enable'); } /** * Returns configured URL for API * * @return string */ public function getNewRelicApiUrl() { return (string)$this->scopeConfig->getValue('newrelicreporting/general/api_url'); } /** * Returns configured URL for Insights API * * @return string */ public function getInsightsApiUrl() { return (string)$this->scopeConfig->getValue('newrelicreporting/general/insights_api_url'); } /** * Returns configured account ID for New Relic * * @return string */ public function getNewRelicAccountId() { return (string)$this->scopeConfig->getValue('newrelicreporting/general/account_id'); } /** * Return configured NR Application ID * * @return int */ public function getNewRelicAppId() { return (int)$this->scopeConfig->getValue('newrelicreporting/general/app_id'); } /** * Returns configured API key for APM * * @return string */ public function getNewRelicApiKey() { return $this->encryptor->decrypt($this->scopeConfig->getValue('newrelicreporting/general/api')); } /** * Returns configured Insights insert key for New Relic events related to cron jobs * * @return string */ public function getInsightsInsertKey() { return $this->encryptor->decrypt($this->scopeConfig->getValue('newrelicreporting/general/insights_insert_key')); } /** * Returns configured NR Application name * * @return string */ public function getNewRelicAppName() { return (string)$this->scopeConfig->getValue('newrelicreporting/general/app_name'); } /** * Returns configured separate apps value * * @return bool */ public function isSeparateApps() { return (bool)$this->scopeConfig->getValue('newrelicreporting/general/separate_apps'); } /** * Returns config setting for overall cron to be enabled * * @return bool */ public function isCronEnabled() { return $this->scopeConfig->isSetFlag('newrelicreporting/cron/enable_cron'); } /** * Sets config value * * @param string $pathId * @param mixed $value * @param string $scope * @param int $scopeId * @return void */ protected function setConfigValue($pathId, $value, $scope = 'default', $scopeId = 0) { $this->resourceConfig->saveConfig($pathId, $value, $scope, $scopeId); } /** * Disable module's functionality for case when new relic extension is not available * * @return void */ public function disableModule() { $this->setConfigValue('newrelicreporting/general/enable', 0); } }