public function testOffsetIsApplied()
 {
     $this->storeThreeProperties();
     $request = new PropertyListingRequest();
     $request->setPerPage(1);
     $request->setPage(2);
     $this->assertEquals(new PropertyList([new PropertyListElement(new PropertyId('P2'), 'commonsMedia', 'https://www.wikidata.org/entity/P2', 'http://test.url/properties/P2')]), $this->apiFactory->newListPropertiesUseCase()->listProperties($request));
 }
 public function getResult(Request $request)
 {
     $listingRequest = new PropertyListingRequest();
     // TODO: strict validation of arguments
     $listingRequest->setPerPage((int) $request->get('per_page', 100));
     $listingRequest->setPage((int) $request->get('page', 1));
     $properties = $this->apiFactory->newListPropertiesUseCase()->listProperties($listingRequest);
     $response = $this->app->json($this->apiFactory->newPropertyListSerializer()->serialize($properties));
     (new PaginationHeaderSetter($response->headers))->setHeaders($request->getUriForPath('/properties'), $listingRequest, count($properties->getElements()));
     return $response;
 }
 private function getPropertyInfo(PropertyListingRequest $request)
 {
     return $this->propertyStore->getPropertyInfo($request->getPerPage(), ($request->getPage() - 1) * $request->getPerPage());
 }