Rename bool flag for user backend

This commit is contained in:
Philipp Holzer 2020-01-17 20:23:30 +01:00
parent 9bb5891645
commit 0af83e6f7c
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
1 changed files with 12 additions and 12 deletions

View File

@ -80,18 +80,18 @@ class StorageManager
* @brief Return storage backend class by registered name * @brief Return storage backend class by registered name
* *
* @param string|null $name Backend name * @param string|null $name Backend name
* @param boolean $userBackend True, if just user specific instances should be returrned (e.g. not SystemResource) * @param boolean $onlyUserBackend True, if just user specific instances should be returrned (e.g. not SystemResource)
* *
* @return Storage\IStorage|null null if no backend registered at $name * @return Storage\IStorage|null null if no backend registered at $name
* *
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public function getByName(string $name = null, $userBackend = false) public function getByName(string $name = null, $onlyUserBackend = false)
{ {
// If there's no cached instance create a new instance // If there's no cached instance create a new instance
if (!isset($this->backendInstances[$name])) { if (!isset($this->backendInstances[$name])) {
// If the current name isn't a valid backend (or the SystemResource instance) create it // If the current name isn't a valid backend (or the SystemResource instance) create it
if ($this->isValidBackend($name, $userBackend)) { if ($this->isValidBackend($name, $onlyUserBackend)) {
switch ($name) { switch ($name) {
// Try the filesystem backend // Try the filesystem backend
case Storage\Filesystem::getName(): case Storage\Filesystem::getName():
@ -130,14 +130,14 @@ class StorageManager
* Checks, if the storage is a valid backend * Checks, if the storage is a valid backend
* *
* @param string|null $name The name or class of the backend * @param string|null $name The name or class of the backend
* @param boolean $userBackend True, if just user backend should get returned (e.g. not SystemResource) * @param boolean $onlyUserBackend True, if just user backend should get returned (e.g. not SystemResource)
* *
* @return boolean True, if the backend is a valid backend * @return boolean True, if the backend is a valid backend
*/ */
public function isValidBackend(string $name = null, bool $userBackend = false) public function isValidBackend(string $name = null, bool $onlyUserBackend = false)
{ {
return array_key_exists($name, $this->backends) || return array_key_exists($name, $this->backends) ||
(!$userBackend && $name === Storage\SystemResource::getName()); (!$onlyUserBackend && $name === Storage\SystemResource::getName());
} }
/** /**