forked from GNUsocial/gnu-social
Diogo Peralta Cordeiro
517ed953f2
Refactored AS2 inside AP; [ENTITY][Activity] went from core to AP Webfinger plugin will be part of FreeNetwork component
25 lines
641 B
PHP
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);
|
|
}
|
|
} |