Remove get() from config transaction interface

This commit is contained in:
Philipp Holzer 2023-01-03 17:26:48 +01:00
parent b439df892a
commit a46cd2fb36
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
2 changed files with 14 additions and 18 deletions

View file

@ -29,22 +29,6 @@ use Friendica\Core\Config\Exception\ConfigPersistenceException;
*/ */
interface ISetConfigValuesTransactionally interface ISetConfigValuesTransactionally
{ {
/**
* Get a particular user's config variable given the category name
* ($cat) and a $key.
*
* Get a particular config value from the given category ($cat)
*
* @param string $cat The category of the configuration value
* @param string $key The configuration key to query
*
* @return mixed Stored value or null if it does not exist
*
* @throws ConfigPersistenceException In case the persistence layer throws errors
*
*/
public function get(string $cat, string $key);
/** /**
* Sets a configuration value for system config * Sets a configuration value for system config
* *

View file

@ -45,8 +45,20 @@ class ConfigTransaction implements ISetConfigValuesTransactionally
$this->delCache = new Cache(); $this->delCache = new Cache();
} }
/** {@inheritDoc} */ /**
public function get(string $cat, string $key) * Get a particular user's config variable given the category name
* ($cat) and a $key from the current transaction.
*
* Isn't part of the interface because of it's rare use case
*
* @param string $cat The category of the configuration value
* @param string $key The configuration key to query
*
* @return mixed Stored value or null if it does not exist
*
* @throws ConfigPersistenceException In case the persistence layer throws errors
*
*/ public function get(string $cat, string $key)
{ {
return !$this->delCache->get($cat, $key) ? return !$this->delCache->get($cat, $key) ?
($this->cache->get($cat, $key) ?? $this->config->get($cat, $key)) : ($this->cache->get($cat, $key) ?? $this->config->get($cat, $key)) :