2023-10-06 15:45:58 +02:00
|
|
|
<?php
|
|
|
|
namespace Activitypub\Transformer;
|
|
|
|
|
|
|
|
use Activitypub\Transformer\Post;
|
|
|
|
use Activitypub\Transformer\Comment;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Transformer Factory
|
|
|
|
*/
|
2023-10-06 17:28:55 +02:00
|
|
|
class Factory {
|
2023-10-06 15:45:58 +02:00
|
|
|
public static function get_transformer( $object ) {
|
|
|
|
switch ( get_class( $object ) ) {
|
|
|
|
case 'WP_Post':
|
|
|
|
return new Post( $object );
|
|
|
|
case 'WP_Comment':
|
|
|
|
return new Comment( $object );
|
|
|
|
default:
|
|
|
|
return apply_filters( 'activitypub_transformer', null, $object, get_class( $object ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|