Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace LIT\MCP\Integrations\Divi;
|
||
|
||
use LIT\MCP\Integrations\Divi\Release\ManifestCheck;
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
/**
|
||
* Live check of the Divi internals LIT MCP relies on (spec §4.3): every check of every adapter manifest – calls
|
||
* with their argument count, constants, registrations and the fingerprints of the mirrors. lit-site-status shows
|
||
* the failed checks, so a Divi update that moves one of them is visible before a tool reports "unsupported".
|
||
*/
|
||
final class DiviCompatibility
|
||
{
|
||
/** @param array<string, callable(): bool>|null $checks Label => check; null = defaults(). */
|
||
public function __construct(private ?array $checks = null)
|
||
{
|
||
}
|
||
|
||
/** @return list<string> Labels of the checks that failed or threw. */
|
||
public function problems(): array
|
||
{
|
||
return ManifestCheck::failed($this->checks ?? self::defaults());
|
||
}
|
||
|
||
/** @return array<string, callable(): bool> */
|
||
public static function defaults(?ManifestCheck $check = null): array
|
||
{
|
||
$check ??= new ManifestCheck();
|
||
|
||
return array_merge($check->codeChecks(), $check->registrationChecks(), $check->mirrorChecks());
|
||
}
|
||
}
|