Skip to content
Snippets Groups Projects
Unverified Commit 9d5362dd authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by GitHub
Browse files

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

Move localecache to array
parents ff08b10a 441a3434
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
namespace OC\L10N; namespace OC\L10N;
use Ds\Set;
use OCP\IConfig; use OCP\IConfig;
use OCP\IRequest; use OCP\IRequest;
use OCP\IUser; use OCP\IUser;
...@@ -65,9 +64,9 @@ class Factory implements IFactory { ...@@ -65,9 +64,9 @@ class Factory implements IFactory {
protected $availableLanguages = []; protected $availableLanguages = [];
/** /**
* @var Set * @var array
*/ */
protected $localeCache; protected $localeCache = [];
/** /**
* @var array * @var array
...@@ -110,7 +109,6 @@ class Factory implements IFactory { ...@@ -110,7 +109,6 @@ class Factory implements IFactory {
$this->request = $request; $this->request = $request;
$this->userSession = $userSession; $this->userSession = $userSession;
$this->serverRoot = $serverRoot; $this->serverRoot = $serverRoot;
$this->localeCache = new Set();
} }
/** /**
...@@ -398,14 +396,14 @@ class Factory implements IFactory { ...@@ -398,14 +396,14 @@ class Factory implements IFactory {
return true; return true;
} }
if ($this->localeCache->isEmpty()) { if ($this->localeCache === []) {
$locales = $this->findAvailableLocales(); $locales = $this->findAvailableLocales();
foreach ($locales as $l) { foreach ($locales as $l) {
$this->localeCache->add($l['code']); $this->localeCache[$l['code']] = true;
} }
} }
return $this->localeCache->contains($locale); return isset($this->localeCache[$locale]);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment