gnu-social/plugins/ActivityPub/Util/Model/EntityToType/EntityToType.php
Diogo Peralta Cordeiro 517ed953f2
[FreeNetwork] First step towards de-duplication mechanism for federation
Refactored AS2 inside AP; [ENTITY][Activity] went from core to AP
Webfinger plugin will be part of FreeNetwork component
2021-10-06 11:48:22 +01:00

30 lines
585 B
PHP

<?php
namespace Plugin\ActivityPub\Util\Model\EntityToType;
use App\Core\Entity;
use Plugin\ActivityPub\Util\Type;
abstract class EntityToType
{
/**
* @param Entity $entity
*
* @throws \Exception
*
* @return Type
*/
public static function translate($entity)
{
switch ($entity::class) {
case 'Note':
return NoteToType::translate($entity);
default:
$map = [
'type' => 'Object',
];
return Type::create($map);
}
}
}