Yoast\WP\SEO\Dashboard\Application\Score_Results

Current_Scores_Repository::get_current_scores()publicYoast 1.0

Returns the current results.

Метод класса: Current_Scores_Repository{}

Хуков нет.

Возвращает

Массив<Массив<Строку,. string|int|array<string, string>>> The current results.

Использование

$Current_Scores_Repository = new Current_Scores_Repository();
$Current_Scores_Repository->get_current_scores( $score_groups, $score_results, $content_type, ?Taxonomy $taxonomy, ?int $term_id ): Current_Scores_List;
$score_groups(Score_Groups_Interface[]) (обязательный)
The score groups.
$score_results(массив) (обязательный)
-
$content_type(Content_Type) (обязательный)
The content type.
?Taxonomy $taxonomy (обязательный)
-
?int $term_id (обязательный)
-

Код Current_Scores_Repository::get_current_scores() Yoast 24.4

public function get_current_scores( array $score_groups, array $score_results, Content_Type $content_type, ?Taxonomy $taxonomy, ?int $term_id ): Current_Scores_List {
	$current_scores_list = new Current_Scores_List();

	foreach ( $score_groups as $score_group ) {
		$score_name          = $score_group->get_name();
		$current_score_links = $this->get_current_score_links( $score_group, $content_type, $taxonomy, $term_id );
		$score_amount        = (int) $score_results['scores']->$score_name;
		$score_ids           = ( isset( $score_results['score_ids'] ) ) ? $score_results['score_ids']->$score_name : null;

		$current_score = new Current_Score( $score_name, $score_amount, $score_ids, $current_score_links );
		$current_scores_list->add( $current_score, $score_group->get_position() );
	}

	return $current_scores_list;
}