[ActivityStreamsTwo] Introduce a structure for data representation in ActivityStreams 2.0

Type factory borrowed from landrok/activitypub
This commit is contained in:
2021-08-24 20:29:26 +01:00
committed by Hugo Sales
parent e4aa3ae968
commit 8880af8197
133 changed files with 7530 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Plugin\ActivityStreamsTwo\Util\Response;
use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\EntityToType;
abstract class AbstractResponse
{
/**
* @param Type $type
* @param int $status The response status code
*
* @throws \Exception
*
* @return TypeResponse
*/
public static function handle($type, int $status = 200): TypeResponse
{
return new TypeResponse(
data: EntityToType::translate($type),
status: $status
);
}
}