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
|
|
|
|
|
|
|
use App\Entity\Note;
|
|
|
|
use Exception;
|
2021-10-04 17:00:58 +01:00
|
|
|
use Plugin\ActivityPub\Util\Model\EntityToType\NoteToType;
|
2021-08-24 20:29:26 +01:00
|
|
|
|
|
|
|
abstract class NoteResponse
|
|
|
|
//class NoteResponse extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param Note $note
|
|
|
|
* @param int $status The response status code
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
*
|
|
|
|
* @return TypeResponse
|
|
|
|
*/
|
|
|
|
public static function handle(Note $note, int $status = 200): TypeResponse
|
|
|
|
// public function handle(Request $request, int $id): JsonResponse
|
|
|
|
{
|
|
|
|
// $note = DB::findOneBy('note', ['id' => $id]);
|
|
|
|
return new TypeResponse(data: NoteToType::translate($note), status: $status);
|
|
|
|
}
|
|
|
|
}
|