Skip to content
Corex

InsightStore

Corex\Config\Insights\InsightStore · class · Config layer

The pure cache + history for insight results. It transforms the decoded option state (provider => {latest, history[]}) — adding a run, reading the latest, or mapping every provider to its latest for the dashboard. The controller owns the actual option read/write, so this stays headless-testable and free of WordPress. Every row is read through {@see InsightFailure}, so a failed run stored by an earlier release as a score of 50 is read as the failure it was (spec 114, US-SAFE-12).

put(array $state, InsightResult $result, int $historyLimit): array

Section titled “put(array $state, InsightResult $result, int $historyLimit): array”

Record a result, returning the new state. History is newest-first and bounded.

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

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

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

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