Files
pterodactyl-panel/app/Services/Extensions/ExtensionSettingsRegistry.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

38 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Services\Extensions;
/**
* The settings definitions extensions have registered this boot, keyed by
* extension id. Populated by ExtensionProvider::registerSettings() while
* providers boot; consumed by the admin extensions API (auto-rendered settings
* forms) and the frontend payload (ctx.config).
*/
class ExtensionSettingsRegistry
{
/** @var array<string, ExtensionSettingsDefinition> */
private array $definitions = [];
public function register(string $identifier, ExtensionSettingsDefinition $definition): void
{
$this->definitions[$identifier] = $definition;
}
public function get(string $identifier): ?ExtensionSettingsDefinition
{
return $this->definitions[$identifier] ?? null;
}
public function unregister(string $identifier): void
{
unset($this->definitions[$identifier]);
}
public function has(string $identifier): bool
{
return isset($this->definitions[$identifier]);
}
}