[Actor] Refactor GSActor into Actor

This commit is contained in:
2021-09-18 03:22:27 +01:00
parent 6c899b7b61
commit 941cbe6599
73 changed files with 489 additions and 484 deletions

View File

@@ -3,7 +3,7 @@
namespace Plugin\ActivityStreamsTwo\Util\Model\EntityToType;
use App\Core\Router\Router;
use App\Entity\GSActor;
use App\Entity\Actor;
use DateTimeInterface;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Type;
@@ -11,13 +11,14 @@ use Plugin\ActivityStreamsTwo\Util\Type;
class GSActorToType
{
/**
* @param GSActor $gsactor
* @param Actor $gsactor
*
* @throws Exception
*@throws Exception
*
* @return Type
*
*/
public static function translate(GSActor $gsactor)
public static function translate(Actor $gsactor)
{
$uri = Router::url('actor_view_id', ['id' => $gsactor->getId()], Router::ABSOLUTE_URL);
$attr = [

View File

@@ -2,21 +2,22 @@
namespace Plugin\ActivityStreamsTwo\Util\Response;
use App\Entity\GSActor;
use App\Entity\Actor;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\GSActorToType;
abstract class ActorResponse
{
/**
* @param GSActor $gsactor
* @param int $status The response status code
* @param Actor $gsactor
* @param int $status The response status code
*
* @throws Exception
*@throws Exception
*
* @return TypeResponse
*
*/
public static function handle(GSActor $gsactor, int $status = 200): 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);