gnu-social/plugins/ActivityPub/Util/Response/ActorResponse.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

25 lines
641 B
PHP

<?php
namespace Plugin\ActivityPub\Util\Response;
use App\Entity\Actor;
use Exception;
use Plugin\ActivityPub\Util\Model\EntityToType\GSActorToType;
abstract class ActorResponse
{
/**
* @param Actor $gsactor
* @param int $status The response status code
*
*@throws Exception
*
* @return TypeResponse
*
*/
public static function handle(Actor $gsactor, int $status = 200): TypeResponse
{
$gsactor->getLocalUser(); // This throws exception if not a local user, which is intended
return new TypeResponse(data: GSActorToType::translate($gsactor), status: $status);
}
}