checker()); } public function run(int $userId): CheckReport { $label = $this->profile->label; $manifest = self::guarded(fn (): array => ManifestCheck::failed( array_merge($this->manifests->codeChecks(), $this->manifests->registrationChecks()) )); $steps = [new CheckStep( CheckStep::MANIFEST, $manifest, false, CheckStep::genericLabel(CheckStep::MANIFEST, $label) )]; if (array_filter($this->profile->manifests, static fn (Manifest $m): bool => $m->mirrors !== []) !== []) { $steps[] = new CheckStep( CheckStep::MIRRORS, self::guarded(fn (): array => ManifestCheck::failed($this->manifests->mirrorChecks())), false, CheckStep::genericLabel(CheckStep::MIRRORS, $label) ); } if ($this->profile->extraSteps !== null) { $steps = [...$steps, ...($this->profile->extraSteps)($manifest === [])]; } $version = (string) ($this->profile->version === null ? '' : ($this->profile->version)()); return new CheckReport( wp_generate_uuid4(), gmdate('c'), $userId, $version, Plugin::VERSION, $this->profile->stateKey === null ? '' : ($this->profile->stateKey)($version), $steps ); } /** @return list The step's problems; a throwing step is one problem. */ public static function guarded(Closure $step): array { try { return array_values(array_filter((array) $step(), 'is_string')); } catch (Throwable $e) { // The report reaches MCP clients through the lock reason; the exception text stays in the log. Log::failure('compat check step', $e); return ['Prüfschritt abgebrochen (Details im PHP-Error-Log).']; } } }