private function getResponse(ResponseInterface $httpResponse) { $response = new Response($httpResponse); if ($httpResponse->getBody()) { $resp = (string) $httpResponse->getBody(); $decoded = json_decode($resp, true); $response->setBody($decoded); } return $response; }
/** * @param array $labels * @param string|null $conn * * @return Response * @deprecetad Will be removed in 4.0 */ public function listIndexes(array $labels = array(), $conn = null) { if (empty($labels)) { $labels = $this->getLabels($conn)->getBody(); } $indexes = []; foreach ($labels as $label) { $res = $this->listIndex($label, $conn); $indexs = $res->getBody(); $indexes[$label] = $indexs; } if (!isset($res)) { if ($this->newFormatModeEnabled) { $res = new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200)); } else { $res = new Response(new PsrResponse(200)); } } if ($res instanceof \GraphAware\NeoClient\Formatter\Response) { return new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200, [], json_encode($indexes))); } $response = new Response($res->getRaw()); $response->setBody($indexes); return $response; }
/** * @param array $labels * @param string|null $conn * * @return Response */ public function listIndexes(array $labels = array(), $conn = null) { if (empty($labels)) { $labels = $this->getLabels($conn)->getBody(); } $indexes = []; foreach ($labels as $label) { $indexs = $this->listIndex($label, $conn)->getBody(); $indexes[$label] = $indexs; } $response = new Response(); $response->setBody($indexes); return $response; }