From f06233d9960d0c576555751043cc601fdcd53a26 Mon Sep 17 00:00:00 2001 From: upstream Date: Thu, 10 Sep 2026 08:56:01 +0200 Subject: [PATCH] Upstream kanboard/kanboard state of the touched files before cf53b54597 --- .../JsonRPC/Request/BatchRequestParser.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 libs/jsonrpc/src/JsonRPC/Request/BatchRequestParser.php diff --git a/libs/jsonrpc/src/JsonRPC/Request/BatchRequestParser.php b/libs/jsonrpc/src/JsonRPC/Request/BatchRequestParser.php new file mode 100644 index 0000000..c0fc776 --- /dev/null +++ b/libs/jsonrpc/src/JsonRPC/Request/BatchRequestParser.php @@ -0,0 +1,55 @@ +payload as $payload) { + $responses[] = RequestParser::create() + ->withPayload($payload) + ->withProcedureHandler($this->procedureHandler) + ->withMiddlewareHandler($this->middlewareHandler) + ->withLocalException($this->localExceptions) + ->parse(); + } + + $responses = array_filter($responses); + return empty($responses) ? '' : '['.implode(',', $responses).']'; + } + + /** + * Return true if we have a batch request + * + * ex : [ + * 0 => '...', + * 1 => '...', + * 2 => '...', + * 3 => '...', + * ] + * + * @static + * @access public + * @param array $payload + * @return bool + */ + public static function isBatchRequest(array $payload) + { + return array_keys($payload) === range(0, count($payload) - 1); + } +}