/** {@inheritdoc} */ public function readProjection($projectionId) { try { $result = $this->client->request(HttpClient::METHOD_GET, $this->projectionResultUri($projectionId), null, HttpClient::FORMAT_PROJECTION); if (empty($result)) { return; } return $result; } catch (RequestException $e) { throw new EventStoreConnectionFailed($e->getMessage()); } }
/** @test */ public function it_fails_when_try_to_send_requests_in_bath_with_wrong_method() { $this->expectException(\RuntimeException::class); $expectedRequest1 = new Request('GET', 'http://some-absolute/uri1', ['Accept' => ['application/vnd.eventstore.atom+json']]); $this->guzzle->sendAsync($expectedRequest1, [])->willReturn(new Response(200, [], '{"some": "data1"}')); $this->client->requestsBatch('PUT', ['http://some-absolute/uri1']); }
private function readEvents(array $eventUris) { $results = $this->client->requestsBatch(HttpClient::METHOD_GET, $eventUris); return array_reverse(array_map(function (array $result) { return new WritableEvent($result['content']['eventType'], $result['content']['data']); }, $results)); }