2021-08-24 20:29:26 +01:00
|
|
|
<?php
|
|
|
|
|
2021-10-04 17:00:58 +01:00
|
|
|
namespace Plugin\ActivityPub\Util\Model\EntityToType;
|
2021-08-24 20:29:26 +01:00
|
|
|
|
2021-09-06 23:47:28 +01:00
|
|
|
use App\Core\Entity;
|
2021-10-04 17:00:58 +01:00
|
|
|
use Plugin\ActivityPub\Util\Type;
|
2021-08-24 20:29:26 +01:00
|
|
|
|
|
|
|
abstract class EntityToType
|
|
|
|
{
|
|
|
|
/**
|
2021-09-06 23:47:28 +01:00
|
|
|
* @param Entity $entity
|
2021-08-24 20:29:26 +01:00
|
|
|
*
|
|
|
|
* @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);
|
|
|
|
}
|
|
|
|
}
|
2021-09-06 23:47:28 +01:00
|
|
|
}
|