14 private static self $instance;
16 private array $configByTypes = [];
17 private bool $isLoaded =
false;
21 private function __construct()
24 $this->converterToCamelCase =
new Converter(Converter::TO_CAMEL | Converter::LC_FIRST);
29 self::$instance ??=
new self();
31 return self::$instance;
54 if (
$config->useDefaultRecentSection)
56 $recentSections[] =
'default';
59 if (
$config->hasOwnRecentSection)
61 $recentSections[] =
$config->getOwnSectionName() ?? $this->converterToCamelCase->process(
$type);
64 return $recentSections;
67 private function load(): void
69 $this->isLoaded =
true;
70 $this->loadInternal();
71 $this->loadExternal();
74 private function loadInternal(): void
76 $this->configByTypes[ExtendedType::Copilot->value] =
new RecentConfig(
true,
true);
77 $this->configByTypes[ExtendedType::AiAssistant->value] =
new RecentConfig(
true,
true);
78 $this->configByTypes[ExtendedType::AiAssistantEntity->value] =
new RecentConfig(
false,
false);
79 $this->configByTypes[ExtendedType::Collab->value] =
new RecentConfig(
true,
true);
80 $this->configByTypes[ExtendedType::Lines->value] =
new RecentConfig(
false,
true);
81 $this->configByTypes[ExtendedType::Comment->value] =
new RecentConfig(
false,
false);
82 $this->configByTypes[ExtendedType::OpenChannel->value] =
new RecentConfig(
true,
true);
83 $this->configByTypes[ExtendedType::GeneralChannel->value]
84 = (
new RecentConfig(
true,
true))->setOwnSectionName(
'openChannel')
88 private function loadExternal(): void
90 $configs = $this->externalTypeRegistry->getConfigs();
94 if (isset($this->configByTypes[
$type]))
99 $this->configByTypes[
$type] =
new RecentConfig(
100 self::EXTERNAL_CHAT_USE_DEFAULT_RECENT_SECTION,