> */ public static function check_classes(): array { $classes = array( ServerStateCheck::class, RewriteRulesCheck::class, AnonymousRestCheck::class, DiscoveryCheck::class, CacheStalenessCheck::class, UserAgentProbeCheck::class, WpCronCheck::class, EdgeLayerCheck::class, ); /** * Filters the troubleshooter's checks. * * A companion plugin can append the class name of its own check. * Order is preserved, so one appended here runs after every built-in * check and may depend on their ids. * * @since 0.4.6 * * @param array $classes Built-in check classes, in run order. */ $filtered = (array) apply_filters( 'acrossai_mcp_troubleshoot_checks', $classes ); $valid = array(); foreach ( $filtered as $class ) { // A filter that returns something else must not take down the one // screen an operator reaches when things are already broken, so // anything that is not a Check implementation is dropped rather // than instantiated. if ( is_a( $class, Check::class, true ) ) { $valid[] = $class; } } return $valid; } /** * Run everything and return the results as flat arrays. * * @return array> */ public static function run_all(): array { $context = new Context(); $results = array(); foreach ( self::check_classes() as $class ) { $check = new $class(); $blockers = $context->blockers( ...$check->requires() ); $result = array() === $blockers ? $check->run( $context ) : Result::skipped( $check->id(), $check->label(), $blockers ); $context->record( $result ); $results[] = $result->to_array(); } return $results; } }