@@ -219,8 +219,9 @@ public function getAllValues(string $app, string $prefix = '', bool $filtered =
219219 // if we want to filter values, we need to get sensitivity
220220 $ this ->loadConfigAll ();
221221 // array_merge() will remove numeric keys (here config keys), so addition arrays instead
222+ $ values = $ this ->formatAppValues ($ app , ($ this ->fastCache [$ app ] ?? []) + ($ this ->lazyCache [$ app ] ?? []));
222223 $ values = array_filter (
223- (( $ this -> fastCache [ $ app ] ?? []) + ( $ this -> lazyCache [ $ app ] ?? [])) ,
224+ $ values ,
224225 function (string $ key ) use ($ prefix ): bool {
225226 return str_starts_with ($ key , $ prefix ); // filter values based on $prefix
226227 }, ARRAY_FILTER_USE_KEY
@@ -271,7 +272,8 @@ public function searchValues(string $key, bool $lazy = false): array {
271272
272273 foreach (array_keys ($ cache ) as $ app ) {
273274 if (isset ($ cache [$ app ][$ key ])) {
274- $ values [$ app ] = $ cache [$ app ][$ key ];
275+ $ appCache = $ this ->formatAppValues ((string )$ app , $ cache [$ app ]);
276+ $ values [$ app ] = $ appCache [$ key ];
275277 }
276278 }
277279
@@ -1386,6 +1388,38 @@ public function getFilteredValues($app) {
13861388 return $ this ->getAllValues ($ app , filtered: true );
13871389 }
13881390
1391+
1392+ /**
1393+ * @param string $app
1394+ * @param array $values
1395+ *
1396+ * @return array
1397+ */
1398+ private function formatAppValues (string $ app , array $ values ): array {
1399+ foreach ($ values as $ key => $ value ) {
1400+ switch ($ this ->getValueType ($ app , $ key )) {
1401+ case self ::VALUE_INT :
1402+ $ values [$ key ] = (int )$ value ;
1403+ break ;
1404+ case self ::VALUE_FLOAT :
1405+ $ values [$ key ] = (float )$ value ;
1406+ break ;
1407+ case self ::VALUE_BOOL :
1408+ $ values [$ key ] = in_array (strtolower ($ value ), ['1 ' , 'true ' , 'yes ' , 'on ' ]);
1409+ break ;
1410+ case self ::VALUE_ARRAY :
1411+ try {
1412+ $ values [$ key ] = json_decode ($ value , true , flags: JSON_THROW_ON_ERROR );
1413+ } catch (JsonException $ e ) {
1414+ // ignoreable
1415+ }
1416+ break ;
1417+ }
1418+ }
1419+
1420+ return $ values ;
1421+ }
1422+
13891423 /**
13901424 * @param string $app
13911425 *
0 commit comments