mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-11 09:34:26 +02:00
Refactoring Core class structures ...
This commit is contained in:
parent
57b4c008cb
commit
b216317477
130 changed files with 1625 additions and 1397 deletions
|
@ -21,13 +21,13 @@
|
|||
|
||||
namespace Friendica\Core\Config\Factory;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Config\Cache\Cache;
|
||||
use Friendica\Core\Config\Model\Config as ConfigModel;
|
||||
use Friendica\Core\Config\Cache\ConfigFileLoader;
|
||||
use Friendica\Core\Config\Capability;
|
||||
use Friendica\Core\Config\Repository;
|
||||
use Friendica\Core\Config\Type;
|
||||
use Friendica\Core\Config\Util;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
|
||||
class ConfigFactory
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
* The key of the $_SERVER variable to override the config directory
|
||||
|
@ -52,11 +52,11 @@ class ConfigFactory
|
|||
|
||||
/**
|
||||
* @param string $basePath The basepath of FRIENDICA
|
||||
* @param array $serer the $_SERVER array
|
||||
* @param array $server The $_SERVER array
|
||||
*
|
||||
* @return \Friendica\Core\Config\Cache\ConfigFileLoader
|
||||
* @return Util\ConfigFileLoader
|
||||
*/
|
||||
public function createConfigFileLoader(string $basePath, array $server = [])
|
||||
public function createConfigFileLoader(string $basePath, array $server = []): Util\ConfigFileLoader
|
||||
{
|
||||
if (!empty($server[self::CONFIG_DIR_ENV]) && is_dir($server[self::CONFIG_DIR_ENV])) {
|
||||
$configDir = $server[self::CONFIG_DIR_ENV];
|
||||
|
@ -65,17 +65,16 @@ class ConfigFactory
|
|||
}
|
||||
$staticDir = $basePath . DIRECTORY_SEPARATOR . self::STATIC_DIR;
|
||||
|
||||
return new ConfigFileLoader($basePath, $configDir, $staticDir);
|
||||
return new Util\ConfigFileLoader($basePath, $configDir, $staticDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Friendica\Core\Config\Cache\ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
|
||||
* @param Util\ConfigFileLoader $loader The Config Cache loader (INI/config/.htconfig)
|
||||
* @param array $server
|
||||
*
|
||||
* @return Cache
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createCache(ConfigFileLoader $loader, array $server = [])
|
||||
public function createCache(Util\ConfigFileLoader $loader, array $server = []): Cache
|
||||
{
|
||||
$configCache = new Cache();
|
||||
$loader->setupCache($configCache, $server);
|
||||
|
@ -84,20 +83,19 @@ class ConfigFactory
|
|||
}
|
||||
|
||||
/**
|
||||
* @param \Friendica\Core\Config\Cache\Cache $configCache The config cache of this adapter
|
||||
* @param ConfigModel $configModel The configuration model
|
||||
* @param Cache $configCache The config cache of this adapter
|
||||
* @param Repository\Config $configRepo The configuration repository
|
||||
*
|
||||
* @return Config\IConfig
|
||||
* @return Capability\IManageConfigValues
|
||||
*/
|
||||
public function create(Cache $configCache, ConfigModel $configModel)
|
||||
public function create(Cache $configCache, Repository\Config $configRepo)
|
||||
{
|
||||
if ($configCache->get('system', 'config_adapter') === 'preload') {
|
||||
$configuration = new Config\Type\PreloadConfig($configCache, $configModel);
|
||||
$configuration = new Type\PreloadConfig($configCache, $configRepo);
|
||||
} else {
|
||||
$configuration = new Config\Type\JitConfig($configCache, $configModel);
|
||||
$configuration = new Type\JitConfig($configCache, $configRepo);
|
||||
}
|
||||
|
||||
|
||||
return $configuration;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue