@@ -56,6 +56,11 @@ class DeploymentConfig
5656 */
5757 private $ envOverrides = [];
5858
59+ /**
60+ * @var array
61+ */
62+ private $ readerLoad = [];
63+
5964 /**
6065 * Constructor
6166 *
@@ -122,13 +127,13 @@ public function getConfigData($key = null)
122127 {
123128 if ($ key === null ) {
124129 if (empty ($ this ->data )) {
125- $ this ->reloadData ();
130+ $ this ->reloadInitialData ();
126131 }
127132 return $ this ->data ;
128133 }
129134 $ result = $ this ->getConfigDataByKey ($ key );
130135 if ($ result === null ) {
131- $ this ->reloadData ();
136+ $ this ->reloadInitialData ();
132137 $ result = $ this ->getConfigDataByKey ($ key );
133138 }
134139 return $ result ;
@@ -178,13 +183,28 @@ private function getEnvOverride() : array
178183 * @throws FileSystemException
179184 * @throws RuntimeException
180185 */
181- private function reloadData (): void
186+ private function reloadInitialData (): void
182187 {
188+ if (empty ($ this ->readerLoad )) {
189+ $ this ->readerLoad = $ this ->reader ->load ();
190+ }
183191 $ this ->data = array_replace (
184- $ this ->reader -> load () ,
192+ $ this ->readerLoad ,
185193 $ this ->overrideData ?? [],
186194 $ this ->getEnvOverride ()
187195 );
196+ }
197+
198+ /**
199+ * Loads the configuration data
200+ *
201+ * @return void
202+ * @throws FileSystemException
203+ * @throws RuntimeException
204+ */
205+ private function reloadData (): void
206+ {
207+ $ this ->reloadInitialData ();
188208 // flatten data for config retrieval using get()
189209 $ this ->flatData = $ this ->flattenParams ($ this ->data );
190210 $ this ->flatData = $ this ->getAllEnvOverrides () + $ this ->flatData ;
0 commit comments