From 49208d758da5671224c8209cf58b49348a906e28 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Mon, 17 Jul 2017 23:48:30 +0700 Subject: [PATCH] Server: use proper batching helper --- src/Server/StandardServer.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Server/StandardServer.php b/src/Server/StandardServer.php index 2cd0c1c..c2c55ce 100644 --- a/src/Server/StandardServer.php +++ b/src/Server/StandardServer.php @@ -1,8 +1,6 @@ helper->assertValidRequest($parsedBody); - $batched = is_array($parsedBody); - - $result = []; - foreach ((array) $parsedBody as $index => $operationParams) { - $result[] = $this->helper->executeOperation($this->config, $operationParams); + if (is_array($parsedBody)) { + return $this->helper->executeBatch($this->config, $parsedBody); + } else { + return $this->helper->executeOperation($this->config, $parsedBody); } - - return $batched ? $result : $result[0]; } }