gnu-social/plugins/ActivityStreamsTwo/Util/Model/AS2ToEntity/AS2ToEntity.php
Diogo Peralta Cordeiro 8880af8197
[ActivityStreamsTwo] Introduce a structure for data representation in ActivityStreams 2.0
Type factory borrowed from landrok/activitypub
2021-09-14 13:13:37 +01:00

21 lines
429 B
PHP

<?php
namespace Plugin\ActivityStreamsTwo\Util\Model\AS2ToEntity;
use App\Core\Entity;
abstract class AS2ToEntity
{
/**
* @param array $activity
*
* @return Entity
*/
public static function translate(array $activity): Entity
{
return match ($activity['type']) {
'Note' => AS2ToNote::translate($activity),
default => Entity::create($activity),
};
}
}