Yoast\WP\SEO\Abilities\Application

Score_Retriever::get_number_of_postsprivateYoast 1.0

Extracts and clamps the number of posts from the input.

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

Хуков нет.

Возвращает

int. The clamped number of posts.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_number_of_posts( $input ): int;
$input(массив) (обязательный)
.

Код Score_Retriever::get_number_of_posts() Yoast 27.7

private function get_number_of_posts( array $input ): int {
	$number = ( $input['number_of_posts'] ?? self::DEFAULT_NUMBER_OF_POSTS );

	return \min( self::MAX_NUMBER_OF_POSTS, \max( 1, (int) $number ) );
}