Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateSyncBackfill::classify
Classify a post into one of the three backfill cases.
Pure function: given identical inputs, always returns the same case.
Метод класса: WCEmailTemplateSyncBackfill{}
Хуков нет.
Возвращает
Строку. One of self::CASE_A, self::CASE_B, self::CASE_C.
Использование
$result = WCEmailTemplateSyncBackfill::classify( $row, $current_core_hash ): string;
- $row(stdClass) (обязательный)
- Row with post_content, post_date, post_modified, post_date_gmt, post_modified_gmt.
- $current_core_hash(строка) (обязательный)
sha1()of the canonical core render for the post's email.
Код WCEmailTemplateSyncBackfill::classify() WCEmailTemplateSyncBackfill::classify WC 10.9.1
private static function classify( \stdClass $row, string $current_core_hash ): string {
$current_post_hash = sha1( (string) ( $row->post_content ?? '' ) );
if ( $current_post_hash === $current_core_hash ) {
return self::CASE_A;
}
return self::was_never_edited( $row ) ? self::CASE_B : self::CASE_C;
}