Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
79 lines
2.3 KiB
PHP
79 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Integrations\Divi\Release;
|
|
|
|
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
|
use LIT\MCP\Integrations\Divi\Design\DesignSystemWriter;
|
|
use LIT\MCP\Integrations\Divi\Design\FontCatalog;
|
|
use LIT\MCP\Integrations\Divi\Design\FontInstaller;
|
|
use LIT\MCP\Integrations\Divi\Design\GlobalColorsAdapter;
|
|
use LIT\MCP\Integrations\Divi\Design\GlobalVariablesAdapter;
|
|
use LIT\MCP\Integrations\Divi\Design\ThemeOptionsAdapter;
|
|
use LIT\MCP\Integrations\Divi\Library\DiviLibraryStore;
|
|
use LIT\MCP\Integrations\Divi\Library\DiviRoles;
|
|
use LIT\MCP\Integrations\Divi\Pages\DiviPages;
|
|
use LIT\MCP\Integrations\Divi\Pages\DynamicContentMap;
|
|
use LIT\MCP\Integrations\Divi\Schema\DiviModules;
|
|
use LIT\MCP\Integrations\Divi\ThemeBuilder\DiviThemeBuilder;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
/** The Divi boundary (spec §3): the only classes that touch Divi, in the order
|
|
* reports list them. */
|
|
final class DiviAdapters
|
|
{
|
|
/** @var list<class-string<DiviAdapter>> */
|
|
public const CLASSES = [
|
|
DiviPages::class,
|
|
DiviLibraryStore::class,
|
|
DiviRoles::class,
|
|
DiviThemeBuilder::class,
|
|
DesignSystemReader::class,
|
|
DesignSystemWriter::class,
|
|
GlobalColorsAdapter::class,
|
|
GlobalVariablesAdapter::class,
|
|
ThemeOptionsAdapter::class,
|
|
FontCatalog::class,
|
|
FontInstaller::class,
|
|
DiviModules::class,
|
|
DynamicContentMap::class,
|
|
];
|
|
|
|
/** @return array<class-string<DiviAdapter>, Manifest> */
|
|
public static function manifests(): array
|
|
{
|
|
$manifests = [];
|
|
foreach (self::CLASSES as $class) {
|
|
$manifests[$class] = $class::manifest();
|
|
}
|
|
|
|
return $manifests;
|
|
}
|
|
|
|
/** @return list<Call> Every Divi call of every manifest, each symbol once (the first entry wins). */
|
|
public static function calls(): array
|
|
{
|
|
$calls = [];
|
|
foreach (self::manifests() as $manifest) {
|
|
foreach ($manifest->calls as $call) {
|
|
$calls[ltrim($call->symbol, '\\')] ??= $call;
|
|
}
|
|
}
|
|
|
|
return array_values($calls);
|
|
}
|
|
|
|
/** @return list<Mirror> */
|
|
public static function mirrors(): array
|
|
{
|
|
$mirrors = [];
|
|
foreach (self::manifests() as $manifest) {
|
|
array_push($mirrors, ...$manifest->mirrors);
|
|
}
|
|
|
|
return $mirrors;
|
|
}
|
|
}
|