2021-08-24 20:29:26 +01:00
|
|
|
<?php
|
|
|
|
|
2021-10-10 09:26:18 +01:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
/**
|
2021-10-10 09:26:18 +01:00
|
|
|
* @param int $status The response status code
|
2021-08-24 20:29:26 +01:00
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
2021-10-10 09:26:18 +01:00
|
|
|
}
|