[ActivityStreamsTwo] Initial Actor support

Various bug fixes
This commit is contained in:
2021-09-14 17:15:37 +01:00
parent 1f3a6fe6ac
commit 365edbaff0
10 changed files with 217 additions and 34 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Plugin\ActivityStreamsTwo\Util\Response;
use App\Entity\GSActor;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\GSActorToType;
abstract class ActorResponse
{
/**
* @param GSActor $gsactor
* @param int $status The response status code
*
* @throws Exception
*
* @return TypeResponse
*/
public static function handle(GSActor $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);
}
}