Last active
April 10, 2017 17:52
-
-
Save davibennun/fb59a7edd2ce0c36501bea8a2e5e2128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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