scrapers = iterator_to_array($scrapers); } public function createScraper(ContentSource $contentSource): ScraperInterface { foreach ($this->scrapers as $scraper) { if ($scraper->supports($contentSource->getScrapingType())) { return $scraper; } } throw new \InvalidArgumentException('Unsupported scraping type: '.$contentSource->getScrapingType()); } }