style(phpcs): fix array syntax in model field + cost tracker
Replace short array syntax [] with array() for WordPress-Core compliance.
This commit is contained in:
@@ -137,12 +137,12 @@ class PRAutoBlogger_OpenRouter_Model_Field {
|
|||||||
* @return string[] Stage names, e.g. ['outline', 'draft', 'polish'] for writing model.
|
* @return string[] Stage names, e.g. ['outline', 'draft', 'polish'] for writing model.
|
||||||
*/
|
*/
|
||||||
private static function get_stages_for_setting( string $field_id ): array {
|
private static function get_stages_for_setting( string $field_id ): array {
|
||||||
$map = [
|
$map = array(
|
||||||
'prautoblogger_analysis_model' => [ 'analysis' ],
|
'prautoblogger_analysis_model' => array( 'analysis' ),
|
||||||
'prautoblogger_writing_model' => [ 'outline', 'draft', 'polish' ],
|
'prautoblogger_writing_model' => array( 'outline', 'draft', 'polish' ),
|
||||||
'prautoblogger_editor_model' => [ 'review' ],
|
'prautoblogger_editor_model' => array( 'review' ),
|
||||||
];
|
);
|
||||||
return $map[ $field_id ] ?? [];
|
return $map[ $field_id ] ?? array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -228,11 +228,11 @@ class PRAutoBlogger_Cost_Tracker {
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
if ( empty( $stages ) ) {
|
if ( empty( $stages ) ) {
|
||||||
return [
|
return array(
|
||||||
'avg_prompt_tokens' => 0.0,
|
'avg_prompt_tokens' => 0.0,
|
||||||
'avg_completion_tokens' => 0.0,
|
'avg_completion_tokens' => 0.0,
|
||||||
'sample_size' => 0,
|
'sample_size' => 0,
|
||||||
];
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cutoff_time = time() - ( $days * DAY_IN_SECONDS );
|
$cutoff_time = time() - ( $days * DAY_IN_SECONDS );
|
||||||
@@ -254,17 +254,17 @@ class PRAutoBlogger_Cost_Tracker {
|
|||||||
$result = $wpdb->get_row( $query, ARRAY_A );
|
$result = $wpdb->get_row( $query, ARRAY_A );
|
||||||
|
|
||||||
if ( ! $result || 0 === (int) ( $result['sample_count'] ?? 0 ) ) {
|
if ( ! $result || 0 === (int) ( $result['sample_count'] ?? 0 ) ) {
|
||||||
return [
|
return array(
|
||||||
'avg_prompt_tokens' => 0.0,
|
'avg_prompt_tokens' => 0.0,
|
||||||
'avg_completion_tokens' => 0.0,
|
'avg_completion_tokens' => 0.0,
|
||||||
'sample_size' => 0,
|
'sample_size' => 0,
|
||||||
];
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return array(
|
||||||
'avg_prompt_tokens' => (float) ( $result['avg_input'] ?? 0 ),
|
'avg_prompt_tokens' => (float) ( $result['avg_input'] ?? 0 ),
|
||||||
'avg_completion_tokens' => (float) ( $result['avg_output'] ?? 0 ),
|
'avg_completion_tokens' => (float) ( $result['avg_output'] ?? 0 ),
|
||||||
'sample_size' => (int) ( $result['sample_count'] ?? 0 ),
|
'sample_size' => (int) ( $result['sample_count'] ?? 0 ),
|
||||||
];
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user