@@ -55,6 +55,24 @@ class Config
5555 public const DISABLED = 'disabled ' ;
5656 public const TRUE = 'true ' ;
5757 public const FALSE = 'false ' ;
58+ /**#@-*/
59+
60+ /**#@+
61+ * Configuration paths
62+ */
63+ public const XML_PATH_ENABLED = 'newrelicreporting/general/enable ' ;
64+ public const XML_PATH_API_URL = 'newrelicreporting/general/api_url ' ;
65+ public const XML_PATH_INSIGHTS_API_URL = 'newrelicreporting/general/insights_api_url ' ;
66+ public const XML_PATH_ACCOUNT_ID = 'newrelicreporting/general/account_id ' ;
67+ public const XML_PATH_APP_ID = 'newrelicreporting/general/app_id ' ;
68+ public const XML_PATH_API_KEY = 'newrelicreporting/general/api ' ;
69+ public const XML_PATH_INSIGHTS_INSERT_KEY = 'newrelicreporting/general/insights_insert_key ' ;
70+ public const XML_PATH_APP_NAME = 'newrelicreporting/general/app_name ' ;
71+ public const XML_PATH_SEPARATE_APPS = 'newrelicreporting/general/separate_apps ' ;
72+ public const XML_PATH_CRON_ENABLED = 'newrelicreporting/cron/enable_cron ' ;
73+ public const XML_PATH_API_MODE = 'newrelicreporting/general/api_mode ' ;
74+ public const XML_PATH_ENTITY_GUID = 'newrelicreporting/general/entity_guid ' ;
75+ public const XML_PATH_NERD_GRAPH_API_URL = 'newrelicreporting/general/nerd_graph_api_url ' ;
5876
5977 /**
6078 * @var ScopeConfigInterface
@@ -95,7 +113,7 @@ public function __construct(
95113 */
96114 public function isNewRelicEnabled ()
97115 {
98- return $ this ->scopeConfig ->isSetFlag (' newrelicreporting/general/enable ' );
116+ return $ this ->scopeConfig ->isSetFlag (self :: XML_PATH_ENABLED );
99117 }
100118
101119 /**
@@ -105,7 +123,7 @@ public function isNewRelicEnabled()
105123 */
106124 public function getNewRelicApiUrl ()
107125 {
108- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/api_url ' );
126+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_API_URL );
109127 }
110128
111129 /**
@@ -115,7 +133,7 @@ public function getNewRelicApiUrl()
115133 */
116134 public function getInsightsApiUrl ()
117135 {
118- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/insights_api_url ' );
136+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_INSIGHTS_API_URL );
119137 }
120138
121139 /**
@@ -125,7 +143,7 @@ public function getInsightsApiUrl()
125143 */
126144 public function getNewRelicAccountId ()
127145 {
128- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/account_id ' );
146+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_ACCOUNT_ID );
129147 }
130148
131149 /**
@@ -135,7 +153,7 @@ public function getNewRelicAccountId()
135153 */
136154 public function getNewRelicAppId ()
137155 {
138- return (int )$ this ->scopeConfig ->getValue (' newrelicreporting/general/app_id ' );
156+ return (int )$ this ->scopeConfig ->getValue (self :: XML_PATH_APP_ID );
139157 }
140158
141159 /**
@@ -145,7 +163,7 @@ public function getNewRelicAppId()
145163 */
146164 public function getNewRelicApiKey ()
147165 {
148- return $ this ->encryptor ->decrypt ($ this ->scopeConfig ->getValue (' newrelicreporting/general/api ' ));
166+ return $ this ->encryptor ->decrypt ($ this ->scopeConfig ->getValue (self :: XML_PATH_API_KEY ));
149167 }
150168
151169 /**
@@ -155,7 +173,7 @@ public function getNewRelicApiKey()
155173 */
156174 public function getInsightsInsertKey ()
157175 {
158- return $ this ->encryptor ->decrypt ($ this ->scopeConfig ->getValue (' newrelicreporting/general/insights_insert_key ' ));
176+ return $ this ->encryptor ->decrypt ($ this ->scopeConfig ->getValue (self :: XML_PATH_INSIGHTS_INSERT_KEY ));
159177 }
160178
161179 /**
@@ -165,7 +183,7 @@ public function getInsightsInsertKey()
165183 */
166184 public function getNewRelicAppName ()
167185 {
168- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/app_name ' );
186+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_APP_NAME );
169187 }
170188
171189 /**
@@ -175,7 +193,7 @@ public function getNewRelicAppName()
175193 */
176194 public function isSeparateApps ()
177195 {
178- return (bool )$ this ->scopeConfig ->getValue (' newrelicreporting/general/separate_apps ' );
196+ return (bool )$ this ->scopeConfig ->getValue (self :: XML_PATH_SEPARATE_APPS );
179197 }
180198
181199 /**
@@ -185,7 +203,7 @@ public function isSeparateApps()
185203 */
186204 public function isCronEnabled ()
187205 {
188- return $ this ->scopeConfig ->isSetFlag (' newrelicreporting/cron/enable_cron ' );
206+ return $ this ->scopeConfig ->isSetFlag (self :: XML_PATH_CRON_ENABLED );
189207 }
190208
191209 /**
@@ -209,7 +227,7 @@ protected function setConfigValue($pathId, $value, $scope = 'default', $scopeId
209227 */
210228 public function disableModule ()
211229 {
212- $ this ->setConfigValue (' newrelicreporting/general/enable ' , 0 );
230+ $ this ->setConfigValue (self :: XML_PATH_ENABLED , 0 );
213231 }
214232
215233 /**
@@ -219,7 +237,7 @@ public function disableModule()
219237 */
220238 public function getApiMode ()
221239 {
222- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/api_mode ' );
240+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_API_MODE );
223241 }
224242
225243 /**
@@ -229,7 +247,7 @@ public function getApiMode()
229247 */
230248 public function getEntityGuid ()
231249 {
232- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/entity_guid ' );
250+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_ENTITY_GUID );
233251 }
234252
235253 /**
@@ -249,6 +267,6 @@ public function isNerdGraphMode()
249267 */
250268 public function getNerdGraphUrl ()
251269 {
252- return (string )$ this ->scopeConfig ->getValue (' newrelicreporting/general/nerd_graph_api_url ' );
270+ return (string )$ this ->scopeConfig ->getValue (self :: XML_PATH_NERD_GRAPH_API_URL );
253271 }
254272}
0 commit comments