protected function productsProvider() { $products = new Products(); $productA = new Product('Avocado', 'Best Avocado in town!', '32.23kb', Money::GBP(180)); $productB = new Product('Apricot', 'Best Avocado in town!', '32.23kb', Money::GBP(150)); $productC = new Product('Avocado x4', 'Great Avocado x4 deal', '32.23kb', Money::GBP(280)); $products->add($productA); $products->add($productB); $products->add($productC); return $products; }
/** * @param Url $url * * @return Products */ public function extract(Url $url) { $products = new Products(); $productsUrls = $this->productListScraper->extractProductLinks($url); foreach ($productsUrls as $productUrl) { $product = $this->productDetailScraper->extractDetail($productUrl); if ($product) { $products->add($product); } } return $products; }