Faster AppConfig->getValues

This commit is contained in:
Robin Appelman 2016-01-03 16:53:44 +01:00 committed by Thomas Müller
parent ae7c49f93c
commit a3cbdcf202
1 changed files with 6 additions and 7 deletions

View File

@ -251,14 +251,13 @@ class AppConfig implements IAppConfig {
if ($key === false) {
return $this->getAppValues($app);
} else {
$configs = [];
foreach ($this->getApps() as $appId) {
if ($this->hasKey($appId, $key)) {
$configs[$appId] = $this->getValue($appId, $key);
}
}
$appIds = $this->getApps();
$values = array_map(function($appId) use ($key) {
return isset($this->cache[$appId][$key]) ? $this->cache[$appId][$key] : null;
}, $appIds);
$result = array_combine($appIds, $values);
return $configs;
return array_filter($result);
}
}