Skip to content
Corex

InsightRunService

Corex\Config\Insights\InsightRunService · class · Config layer

Consolidates the Insights run/history/recommendation workflow over the pure {@see InsightStore} and the {@see InsightRegistry}. It runs a real provider against a URL, records the result in the bounded history, and aggregates the plain-language recommendations from every provider’s latest stored result. It takes and returns the stored state array (never touches WordPress options), so it stays unit-testable; the controller owns the option read/write.

__construct(InsightRegistry $registry, InsightStore $store)

Section titled “__construct(InsightRegistry $registry, InsightStore $store)”

run(string $providerId, string $url, array $state): ?array

Section titled “run(string $providerId, string $url, array $state): ?array”

Run a provider against $url and record it. Returns the updated state and the result payload, or null when the provider id is unknown (never a fabricated result).

history(array $state, string $providerId): array

Section titled “history(array $state, string $providerId): array”

latest(array $state, string $providerId): ?array

Section titled “latest(array $state, string $providerId): ?array”

The actionable recommendations from every provider’s latest stored result. Providers with no run yet, or a clean result with no recommendations, are omitted — never a fabricated action.