From 8fb8bce5c8b3814ad57dcc49771ba1686b780844 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Feb 2026 10:08:32 +0000 Subject: [PATCH] =?UTF-8?q?Dateien=20nach=20=E2=80=9Ebavarian-rank-engine/?= =?UTF-8?q?includes/Providers=E2=80=9C=20hochladen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../includes/Providers/ProviderRegistry.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bavarian-rank-engine/includes/Providers/ProviderRegistry.php diff --git a/bavarian-rank-engine/includes/Providers/ProviderRegistry.php b/bavarian-rank-engine/includes/Providers/ProviderRegistry.php new file mode 100644 index 0000000..a06d95c --- /dev/null +++ b/bavarian-rank-engine/includes/Providers/ProviderRegistry.php @@ -0,0 +1,45 @@ +providers[ $provider->getId() ] = $provider; + } + + public function get( string $id ): ?ProviderInterface { + return $this->providers[ $id ] ?? null; + } + + /** @return ProviderInterface[] */ + public function all(): array { + return $this->providers; + } + + /** Reset singleton — for use in tests only */ + public static function reset(): void { + self::$instance = null; + } + + /** Returns ['id' => 'Name'] for dropdowns */ + public function getSelectOptions(): array { + $options = array(); + foreach ( $this->providers as $id => $provider ) { + $options[ $id ] = $provider->getName(); + } + return $options; + } +}