@@ -210,12 +210,17 @@ public function isLazy(string $app, string $key): bool {
210210 * @return array<string, string> [configKey => configValue]
211211 * @since 29.0.0
212212 */
213- public function getAllValues (string $ app , string $ key = '' , bool $ filtered = false ): array {
214- $ this ->assertParams ($ app , $ key );
213+ public function getAllValues (string $ app , string $ prefix = '' , bool $ filtered = false ): array {
214+ $ this ->assertParams ($ app , $ prefix );
215215 // if we want to filter values, we need to get sensitivity
216216 $ this ->loadConfigAll ();
217217 // array_merge() will remove numeric keys (here config keys), so addition arrays instead
218- $ values = ($ this ->fastCache [$ app ] ?? []) + ($ this ->lazyCache [$ app ] ?? []);
218+ $ values = array_filter (
219+ (($ this ->fastCache [$ app ] ?? []) + ($ this ->lazyCache [$ app ] ?? [])),
220+ function (string $ key ) use ($ prefix ): bool {
221+ return str_starts_with ($ key , $ prefix ); // filter values based on $prefix
222+ }, ARRAY_FILTER_USE_KEY
223+ );
219224
220225 if (!$ filtered ) {
221226 return $ values ;
@@ -839,10 +844,6 @@ public function updateType(string $app, string $key, int $type = self::VALUE_MIX
839844 $ this ->loadConfigAll ();
840845 $ lazy = $ this ->isLazy ($ app , $ key );
841846
842- if (!$ this ->hasKey ($ app , $ key , $ lazy )) {
843- throw new AppConfigUnknownKeyException ('Unknown config key ' );
844- }
845-
846847 // type can only be one type
847848 if (!in_array ($ type , [self ::VALUE_MIXED , self ::VALUE_STRING , self ::VALUE_INT , self ::VALUE_FLOAT , self ::VALUE_BOOL , self ::VALUE_ARRAY ])) {
848849 throw new AppConfigIncorrectTypeException ('Unknown value type ' );
0 commit comments