fix #8, transformer not found
Some checks failed
PHP_CodeSniffer / phpcs (push) Failing after 5m0s
Unit Testing / phpunit (5.6, 6.2) (push) Failing after 5m29s
Unit Testing / phpunit (7.0) (push) Failing after 5m38s
Unit Testing / phpunit (7.2) (push) Failing after 5m23s
Unit Testing / phpunit (7.3) (push) Failing after 6m17s
Unit Testing / phpunit (7.4) (push) Failing after 6m46s
Unit Testing / phpunit (8.0) (push) Failing after 6m31s
Unit Testing / phpunit (8.1) (push) Failing after 6m20s
Unit Testing / phpunit (8.2) (push) Failing after 6m25s
Unit Testing / phpunit (latest) (push) Failing after 6m10s

This commit is contained in:
Author: ruru4143 2023-12-08 14:04:22 +01:00 committed by ruru4143
parent d322e8e21d
commit 31c09cd329

View file

@ -278,6 +278,11 @@ class Transformer_Factory {
$transformer_mapping = \get_option( 'activitypub_transformer_mapping', self::DEFAULT_TRANSFORMER_MAPPING );
$transformer_name = $transformer_mapping[ $post_type ];
$transformer_class = $this->get_transformers( $transformer_name );
if ( null === $transformer_class ) {
wp_die("transformer '". $transformer_name . "' not found", '', ["response" => 404]);
}
$transformer_instance = new $transformer_class();
$transformer_instance->set_wp_post( $wp_object );
return $transformer_instance->transform();