2021-08-24 20:29:26 +01:00
|
|
|
<?php
|
|
|
|
|
2021-10-04 17:00:58 +01:00
|
|
|
namespace Plugin\ActivityPub\Util\Response;
|
2021-08-24 20:29:26 +01:00
|
|
|
|
2021-10-04 17:00:58 +01:00
|
|
|
use Plugin\ActivityPub\Util\Model\EntityToType\EntityToType;
|
2021-08-24 20:29:26 +01:00
|
|
|
|
|
|
|
abstract class AbstractResponse
|
|
|
|
{
|
|
|
|
/**
|
2021-09-06 23:47:28 +01:00
|
|
|
* param Type $type // What is this `Type`
|
|
|
|
*
|
|
|
|
* @param int $status The response status code
|
|
|
|
* @param mixed $type
|
2021-08-24 20:29:26 +01:00
|
|
|
*
|
|
|
|
* @throws \Exception
|
|
|
|
*
|
|
|
|
* @return TypeResponse
|
|
|
|
*/
|
|
|
|
public static function handle($type, int $status = 200): TypeResponse
|
|
|
|
{
|
|
|
|
return new TypeResponse(
|
|
|
|
data: EntityToType::translate($type),
|
|
|
|
status: $status
|
|
|
|
);
|
|
|
|
}
|
2021-09-06 23:47:28 +01:00
|
|
|
}
|