gnu-social/plugins/ActivityStreamsTwo/Util/Response/AbstractResponse.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

24 lines
532 B
PHP

<?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
);
}
}