Merge pull request #23838 from nextcloud/enh/localecache/toarray

Move localecache to array
This commit is contained in:
Roeland Jago Douma 2020-11-02 16:43:12 +01:00 committed by GitHub
commit 9d5362dd8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -37,7 +37,6 @@
namespace OC\L10N;
use Ds\Set;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUser;
@ -65,9 +64,9 @@ class Factory implements IFactory {
protected $availableLanguages = [];
/**
* @var Set
* @var array
*/
protected $localeCache;
protected $localeCache = [];
/**
* @var array
@ -110,7 +109,6 @@ class Factory implements IFactory {
$this->request = $request;
$this->userSession = $userSession;
$this->serverRoot = $serverRoot;
$this->localeCache = new Set();
}
/**
@ -398,14 +396,14 @@ class Factory implements IFactory {
return true;
}
if ($this->localeCache->isEmpty()) {
if ($this->localeCache === []) {
$locales = $this->findAvailableLocales();
foreach ($locales as $l) {
$this->localeCache->add($l['code']);
$this->localeCache[$l['code']] = true;
}
}
return $this->localeCache->contains($locale);
return isset($this->localeCache[$locale]);
}
/**