mirror of
https://github.com/friendica/friendica
synced 2025-04-26 21:10:16 +00:00
3) Introducing ConfigFactory
This commit is contained in:
parent
5c50684b50
commit
4af0119b73
23 changed files with 843 additions and 632 deletions
45
src/Factory/ConfigFactory.php
Normal file
45
src/Factory/ConfigFactory.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Factory;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
class ConfigFactory
|
||||
{
|
||||
public static function createCache(Config\ConfigCacheLoader $loader)
|
||||
{
|
||||
$configCache = new Config\ConfigCache();
|
||||
$loader->loadConfigFiles($configCache);
|
||||
|
||||
return $configCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type The adapter type
|
||||
* @param Config\IConfigCache $config The config cache of this adapter
|
||||
* @return Config\IConfigAdapter
|
||||
*/
|
||||
public static function createConfig($type, $config)
|
||||
{
|
||||
if ($type == 'preload') {
|
||||
return new Config\PreloadConfigAdapter($config);
|
||||
} else {
|
||||
return new Config\JITConfigAdapter($config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type The adapter type
|
||||
* @param int $uid The UID of the current user
|
||||
* @param Config\IPConfigCache $config The config cache of this adapter
|
||||
* @return Config\IPConfigAdapter
|
||||
*/
|
||||
public static function createPConfig($type, $uid, $config)
|
||||
{
|
||||
if ($type == 'preload') {
|
||||
return new Config\PreloadPConfigAdapter($uid, $config);
|
||||
} else {
|
||||
return new Config\JITPConfigAdapter($config);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue