$checks Checks to run, in report order. */ public function __construct( private readonly array $checks = array() ) { } /** * Run every check. * * A check that throws costs its own row and nothing else. The five look * at unrelated surfaces - abilities, credentials, users, files - and one * of them meeting a site it did not expect is not a reason to hand back * an empty page. */ public function run(): ScanReport { $results = array(); foreach ( $this->checks as $check ) { try { $results[] = new CheckResult( $check->id(), $check->label(), $check->run() ); } catch ( Throwable $error ) { $results[] = new CheckResult( $check->id(), $check->label(), array(), $error->getMessage() ); } } return new ScanReport( $results ); } }