Yoast\WP\SEO\MyYoast_Client\Infrastructure\Registration

Client_Registration::build_update_request_bodyprivateYoast 1.0

Strips server-assigned fields from metadata for a RFC 7592 PUT request.

Per RFC 7592 §2.2, the update request body MUST NOT include fields that are assigned by the server (e.g. registration_client_uri, client_id_issued_at, client_secret, client_secret_expires_at). The software_statement is also stripped since a fresh one is provided.

phpcs:disable SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint -- OAuth metadata is an associative array with heterogeneous values.

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

Хуков нет.

Возвращает

Массив<Строку,. mixed> The metadata suitable for a PUT request body.

phpcs:enable SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint.DisallowedMixedTypeHint

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

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

Код Client_Registration::build_update_request_body() Yoast 27.7

private function build_update_request_body( array $metadata ): array {
	unset(
		$metadata['registration_access_token'],
		$metadata['registration_client_uri'],
		$metadata['client_id_issued_at'],
		$metadata['client_secret'],
		$metadata['client_secret_expires_at'],
		$metadata['software_statement'],
	);

	return $metadata;
}