get_url_params(); return isset($params[$name]) ? (int) $params[$name] : 0; } /** Refuses a post in the Trash, whose status and sync row belong to the restore. */ protected function refuseInTrash(string $postStatus): ?WP_REST_Response { if ($postStatus !== 'trash') { return null; } return $this->sendError( __('This post is in the Trash. Restore it first.', 'publishdeck'), 409, 'fspd_post_trashed' ); } /** * @param mixed $data */ protected function sendSuccess($data = [], int $status = 200): WP_REST_Response { return new WP_REST_Response(['success' => true, 'data' => $data], $status); } protected function sendError( string $message, int $status = 400, string $code = 'fspd_error' ): WP_REST_Response { return new WP_REST_Response( ['success' => false, 'error' => ['code' => $code, 'message' => $message]], $status ); } }