NoteResponse.php 698 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Plugin\ActivityStreamsTwo\Util\Response;
  3. use App\Entity\Note;
  4. use Exception;
  5. use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\NoteToType;
  6. abstract class NoteResponse
  7. //class NoteResponse extends Controller
  8. {
  9. /**
  10. * @param Note $note
  11. * @param int $status The response status code
  12. *
  13. * @throws Exception
  14. *
  15. * @return TypeResponse
  16. */
  17. public static function handle(Note $note, int $status = 200): TypeResponse
  18. // public function handle(Request $request, int $id): JsonResponse
  19. {
  20. // $note = DB::findOneBy('note', ['id' => $id]);
  21. return new TypeResponse(data: NoteToType::translate($note), status: $status);
  22. }
  23. }