diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b9e130..568c064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ All notable changes to `spatie/crawler` will be documented in this file. -## 4.0.0 - 2018-XX-XX +## 4.0.1 - 2018-03-01 + +- fix bugs when installed in Laravel projects + +## 4.0.0 - 2018-03-01 - the `CrawlObserver` and `CrawlProfile` are upgraded from interfaces to abstract classes - don't crawl `tel:` links diff --git a/src/CrawlQueue/CollectionCrawlQueue.php b/src/CrawlQueue/CollectionCrawlQueue.php index 823f8b3..75d2930 100644 --- a/src/CrawlQueue/CollectionCrawlQueue.php +++ b/src/CrawlQueue/CollectionCrawlQueue.php @@ -16,9 +16,9 @@ class CollectionCrawlQueue implements CrawlQueue public function __construct() { - $this->urls = collect(); + $this->urls = new Collection(); - $this->pendingUrls = collect(); + $this->pendingUrls = new Collection(); } public function add(CrawlUrl $url): CrawlQueue diff --git a/src/Crawler.php b/src/Crawler.php index 50f2c19..b468f77 100644 --- a/src/Crawler.php +++ b/src/Crawler.php @@ -357,7 +357,7 @@ protected function addAllLinksToCrawlQueue(string $html, UriInterface $foundOnUr { $allLinks = $this->extractAllLinks($html, $foundOnUrl); - collect($allLinks) + (new Collection($allLinks)) ->filter(function (UriInterface $url) { return $this->hasCrawlableScheme($url); }) @@ -408,7 +408,7 @@ protected function extractAllLinks(string $html, UriInterface $foundOnUrl): Coll $domCrawler = new DomCrawler($html, $foundOnUrl); - return collect($domCrawler->filterXpath('//a')->links()) + return (new Collection($domCrawler->filterXpath('//a')->links())) ->map(function (Link $link) { try { return new Uri($link->getUri());