2021-08-25 04:29:26 +09:00
|
|
|
<?php
|
|
|
|
|
2021-10-10 17:26:18 +09:00
|
|
|
declare(strict_types = 1);
|
|
|
|
|
2021-10-05 01:00:58 +09:00
|
|
|
namespace Plugin\ActivityPub\Util\Response;
|
2021-08-25 04:29:26 +09:00
|
|
|
|
|
|
|
use App\Entity\Note;
|
|
|
|
use Exception;
|
2021-10-05 01:00:58 +09:00
|
|
|
use Plugin\ActivityPub\Util\Model\EntityToType\NoteToType;
|
2021-08-25 04:29:26 +09:00
|
|
|
|
|
|
|
abstract class NoteResponse
|
|
|
|
//class NoteResponse extends Controller
|
|
|
|
{
|
|
|
|
/**
|
2021-10-10 17:26:18 +09:00
|
|
|
* @param int $status The response status code
|
2021-08-25 04:29:26 +09: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 17:26:18 +09:00
|
|
|
}
|