Files
rspade_system/app/RSpade/Core/IntegrationRegistry.php
root 29c657f7a7 Exclude tests directory from framework publish
Add 100+ automated unit tests from .expect file specifications
Add session system test
Add rsx:constants:regenerate command test
Add rsx:logrotate command test
Add rsx:clean command test
Add rsx:manifest:stats command test
Add model enum system test
Add model mass assignment prevention test
Add rsx:check command test
Add migrate:status command test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-25 03:59:58 +00:00

83 lines
2.1 KiB
PHP

<?php
namespace App\RSpade\Core;
use RuntimeException;
use App\RSpade\Core\Bundle\BundleIntegration_Abstract;
/**
* IntegrationRegistry - Central registry for framework integrations
*
* This class tracks all registered integrations and provides
* a central access point for the framework to interact with them.
* Integrations are registered via service providers.
*/
class IntegrationRegistry
{
/**
* Registered integrations
* Format: ['name' => integration_class]
*/
protected static array $integrations = [];
/**
* Register an integration
*
* @param string $integration_class The fully qualified class name of the integration
* @return void
*/
public static function register(string $integration_class): void
{
// Validate the class extends BundleIntegration_Abstract
if (!is_subclass_of($integration_class, BundleIntegration_Abstract::class)) {
throw new RuntimeException("Integration class {$integration_class} must extend BundleIntegration_Abstract");
}
$name = $integration_class::get_name();
static::$integrations[$name] = $integration_class;
}
/**
* Get all registered integrations
*
* @return array Array of integration class names
*/
public static function get_all(): array
{
return array_values(static::$integrations);
}
/**
* Get an integration by name
*
* @param string $name Integration name
* @return string|null Integration class name or null if not found
*/
public static function get(string $name): ?string
{
return static::$integrations[$name] ?? null;
}
/**
* Check if an integration is registered
*
* @param string $name Integration name
* @return bool
*/
public static function has(string $name): bool
{
return isset(static::$integrations[$name]);
}
/**
* Clear all registered integrations
* (Mainly for testing purposes)
*
* @return void
*/
public static function clear(): void
{
static::$integrations = [];
}
}