mirror of
https://github.com/friendica/friendica
synced 2025-04-29 09:04:24 +02:00
Move PConfig to strategies
This commit is contained in:
parent
58f56c7d7d
commit
8ed94037d5
2 changed files with 10 additions and 17 deletions
|
@ -22,28 +22,16 @@
|
|||
namespace Friendica\Core\PConfig\Factory;
|
||||
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Hooks\Capabilities\ICanCreateInstances;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\PConfig\Repository;
|
||||
use Friendica\Core\PConfig\Type;
|
||||
use Friendica\Core\PConfig\ValueObject;
|
||||
|
||||
class PConfig
|
||||
{
|
||||
/**
|
||||
* @param IManageConfigValues $config The config
|
||||
* @param ValueObject\Cache $pConfigCache The personal config cache
|
||||
* @param Repository\PConfig $configRepo The configuration model
|
||||
*
|
||||
* @return IManagePersonalConfigValues
|
||||
*/
|
||||
public function create(IManageConfigValues $config, ValueObject\Cache $pConfigCache, Repository\PConfig $configRepo): IManagePersonalConfigValues
|
||||
public function create(ICanCreateInstances $instanceCreator, IManageConfigValues $config): IManagePersonalConfigValues
|
||||
{
|
||||
if ($config->get('system', 'config_adapter') === 'preload') {
|
||||
$configuration = new Type\PreloadPConfig($pConfigCache, $configRepo);
|
||||
} else {
|
||||
$configuration = new Type\JitPConfig($pConfigCache, $configRepo);
|
||||
}
|
||||
$strategy = $config->get('system', 'config_adapter');
|
||||
|
||||
return $configuration;
|
||||
/** @var IManagePersonalConfigValues */
|
||||
return $instanceCreator->create(IManagePersonalConfigValues::class, $strategy);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue