Skip to content

Instantly share code, notes, and snippets.

@davibennun
Last active April 10, 2017 17:52
Show Gist options
  • Save davibennun/fb59a7edd2ce0c36501bea8a2e5e2128 to your computer and use it in GitHub Desktop.
Save davibennun/fb59a7edd2ce0c36501bea8a2e5e2128 to your computer and use it in GitHub Desktop.
<?php
//Usage
$jomashopEbayItemsRequest = new RequestItemsFromStore();
$jomashopEbayItemsRequest->setStore('jomashop');
$jomashopEbayItems = $jomashopEbayItemsRequest->getAllItems();
$worldOfWatchesEbayItemsRequest = new RequestItemsFromStore();
$jomashopEbayItemsRequest->setStore('woldofwatches');
$worldOfWatchesEbayItems = $jomashopEbayItemsRequest->getAllItems();
class RequestItemsFromStore {
public function __construct(){
$this->eBayService = new DavidSadler\Services\ShoppingService;
}
public function setStore($store){
$this->storeName = $store;
}
public function getAllItems(){
$totalPages = $this->eBayService->getPageCount($this->storeName);
$result = array();
while($page <= $totalPages){
$result[] = $this->getItemsFromPage($page);
$page++;
}
}
public function getItemsFromPage($pageNumber){
return $this->eBayService->findItemsIneBayStores($this->storeName, $pageNnmber);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment