|CheckSet $checks Checks to run, in report order; * a set is asked when the scan runs, * so a runner made before extensions * registered still runs their checks. */ public function __construct( private readonly array|CheckSet $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(); $checks = $this->checks instanceof CheckSet ? $this->checks->all() : $this->checks; foreach ( $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 ); } }