notificationService = $notificationService; } /** * @param WP_REST_Request $data * * @return WP_REST_Response * * @throws InvalidArgumentException * @throws ForbiddenException */ public function handle(WP_REST_Request $data): WP_REST_Response { Sanitizer::verifyNonce($data->get_header('X-WP-Nonce')); $notificationIds = Sanitizer::sanitizeIds($data->get_param('ids')); if (empty($notificationIds)) { throw new InvalidArgumentException( BackendStrings::getExceptionStrings()['notification_ids_required'] ); } $this->notificationService->deleteNotifications($notificationIds); return new WP_REST_Response([ 'message' => BackendStrings::getCommonStrings()['ok'], 'data' => [] ], 200); } }