$model * @param int $post_id * @param string $subtree_id * @return array */ protected function analyze( array $model, int $post_id, string $subtree_id ): array { $rows = $model['rows']; $multi = array_values( array_filter( $rows, static fn( array $r ): bool => (int) $r['lane_count'] > 1 ) ); if ( count( $multi ) < 2 ) { return array( 'findings' => array(), 'score' => 100, 'message' => __( 'Fewer than two multi-lane rows, so there is no ratio pattern to report.', 'acrossai-abilities-manager' ), ); } $counts = array_count_values( array_map( static fn( array $r ): string => (string) $r['ratio'], $multi ) ); arsort( $counts ); $dominant = (string) array_key_first( $counts ); $share = $counts[ $dominant ] / count( $multi ); $findings = array(); if ( $share >= 0.6 && $counts[ $dominant ] >= 3 ) { $findings[] = array( 'type' => 'dominant_column_ratio', 'ratio' => $dominant, 'rows' => $counts[ $dominant ], 'of' => count( $multi ), 'severity' => $share >= 0.85 ? 'medium' : 'low', 'message' => sprintf( /* translators: 1: ratio, 2: matching rows, 3: total multi-lane rows */ __( '%2$d of %3$d multi-lane rows use the same %1$s split.', 'acrossai-abilities-manager' ), $dominant, $counts[ $dominant ], count( $multi ) ), ); } return array( 'findings' => $findings, 'recommendations' => array() === $findings ? array() : array( array( 'suggestion' => __( 'Vary the split on at least one row if the content justifies it — a different ratio is how a reader tells one section from the next. Keep it if the rows are genuinely peers.', 'acrossai-abilities-manager' ) ), ), 'score' => (int) round( 100 - max( 0, $share - 0.5 ) * 120 ), 'extras' => array( 'ratio_counts' => $counts ), ); } }