PHPCS: fix remaining alignment warnings + multi-line SQL disable/enable blocks

This commit is contained in:
peptiderepo
2026-06-13 09:57:42 +00:00
parent dfaee0bca6
commit 8a38949cee
4 changed files with 19 additions and 16 deletions

View File

@@ -64,7 +64,7 @@ class PRV_Ai_Visibility_Collector implements PRV_Data_Collector {
$table = PRV_Table_Manager::get_table_name(); $table = PRV_Table_Manager::get_table_name();
// ── Trendline: one score per run_id ──────────────────────────── // ── Trendline: one score per run_id ────────────────────────────
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$run_rows = $wpdb->get_results( $run_rows = $wpdb->get_results(
"SELECT run_id, MIN(captured_at) AS captured_at, "SELECT run_id, MIN(captured_at) AS captured_at,
SUM(cited) AS cited_count, SUM(cited) AS cited_count,
@@ -76,6 +76,7 @@ class PRV_Ai_Visibility_Collector implements PRV_Data_Collector {
LIMIT 52", LIMIT 52",
ARRAY_A ARRAY_A
); );
// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$trendline = array(); $trendline = array();
foreach ( (array) $run_rows as $row ) { foreach ( (array) $run_rows as $row ) {
@@ -102,11 +103,12 @@ class PRV_Ai_Visibility_Collector implements PRV_Data_Collector {
WHERE run_id = (SELECT run_id FROM {$table} ORDER BY captured_at DESC LIMIT 1) WHERE run_id = (SELECT run_id FROM {$table} ORDER BY captured_at DESC LIMIT 1)
GROUP BY peptide_slug, peptide_label", GROUP BY peptide_slug, peptide_label",
ARRAY_A ARRAY_A
); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching );
// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$standings = array(); $standings = array();
foreach ( (array) $standing_rows as $row ) { foreach ( (array) $standing_rows as $row ) {
$top_domains = $this->extract_top_domains( (string) ( $row['domains_json_list'] ?? '' ) ); $top_domains = $this->extract_top_domains( (string) ( $row['domains_json_list'] ?? '' ) ); // phpcs:ignore Generic.Formatting.MultipleStatementAlignment.NotSameWarning
$standings[ (string) $row['peptide_slug'] ] = array( $standings[ (string) $row['peptide_slug'] ] = array(
'label' => (string) $row['peptide_label'], 'label' => (string) $row['peptide_label'],
'cited' => (bool) (int) $row['cited'], 'cited' => (bool) (int) $row['cited'],
@@ -118,7 +120,8 @@ class PRV_Ai_Visibility_Collector implements PRV_Data_Collector {
// ── Run metadata ──────────────────────────────────────────────── // ── Run metadata ────────────────────────────────────────────────
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$last_run = $wpdb->get_var( "SELECT MAX(captured_at) FROM {$table}" ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $last_run = $wpdb->get_var( "SELECT MAX(captured_at) FROM {$table}" );
// phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
return array( return array(
'trendline' => $trendline, 'trendline' => $trendline,

View File

@@ -61,9 +61,9 @@ class PRV_Gateway_Client {
* @throws \RuntimeException On permanent HTTP failure or parse error. * @throws \RuntimeException On permanent HTTP failure or parse error.
*/ */
public function post_to_gateway( string $provider_slug, array $body, string $api_key, string $endpoint = '/chat/completions' ): array { public function post_to_gateway( string $provider_slug, array $body, string $api_key, string $endpoint = '/chat/completions' ): array {
$base_url = $this->build_base_url( $provider_slug ); $base_url = \$this->build_base_url( \$provider_slug );
$url = $base_url . $endpoint; $url = \$base_url . \$endpoint;
$base_host = (string) wp_parse_url( $base_url, PHP_URL_HOST ); $base_host = (string) wp_parse_url( \$base_url, PHP_URL_HOST );
$headers = array( $headers = array(
'Authorization' => 'Bearer ' . $api_key, 'Authorization' => 'Bearer ' . $api_key,