$results One per check, in the order run. */ public function __construct( public readonly array $results = array() ) { } /** * Every finding across every check, in check order. * * @return list */ public function findings(): array { $findings = array(); foreach ( $this->results as $result ) { foreach ( $result->findings as $finding ) { $findings[] = $finding; } } return $findings; } /** * Findings per severity, for the summary band. * * Every severity is present even at zero: a band that renders only the * non-empty counts moves its own labels around as a site changes. * * @return array */ public function counts(): array { $counts = array(); foreach ( Severity::cases() as $severity ) { $counts[ $severity->value ] = 0; } foreach ( $this->findings() as $finding ) { ++$counts[ $finding->severity->value ]; } return $counts; } /** * Whether the site has nothing to answer for. * * A check that failed is not an all-clear: it is a question nobody * answered, and saying "clear" over it would be a lie the agency repeats * to its client. */ public function is_clear(): bool { foreach ( $this->results as $result ) { if ( $result->failed() || array() !== $result->findings ) { return false; } } return true; } }