forked from GNUsocial/gnu-social
[ActivityStreamsTwo] Initial Actor support
Various bug fixes
This commit is contained in:
24
plugins/ActivityStreamsTwo/Util/Response/ActorResponse.php
Normal file
24
plugins/ActivityStreamsTwo/Util/Response/ActorResponse.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user