providers[ $provider->get_name() ] = $provider; } } /** * Retrieves a cloud storage provider by its name. * * @param string $cloud_name The name of the cloud provider to retrieve. * @return ProviderInterface The repository interface for the specified cloud provider. * @throws \Exception If the specified provider does not exist. */ public function get_provider( string $cloud_name ): ProviderInterface { if ( ! isset( $this->providers[ $cloud_name ] ) ) { throw new \Exception( "Unknown provider: $cloud_name" ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped } return $this->providers[ $cloud_name ]; } /** * Retrieves all registered cloud storage providers. * * @return array List of all cloud storage provider instances. */ public function get_all_providers(): array { return $this->providers; } }