����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 13.59.90.172 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/bofirm.gltechlimited.com/vendor/spatie/crawler/src/CrawlQueues/ |
Upload File : |
<?php namespace Spatie\Crawler\CrawlQueues; use Psr\Http\Message\UriInterface; use Spatie\Crawler\CrawlUrl; use Spatie\Crawler\Exceptions\InvalidUrl; use Spatie\Crawler\Exceptions\UrlNotFoundByIndex; class ArrayCrawlQueue implements CrawlQueue { /** * All known URLs, indexed by URL string. * * @var CrawlUrl[] */ protected array $urls = []; /** * Pending URLs, indexed by URL string. * * @var CrawlUrl[] */ protected array $pendingUrls = []; public function add(CrawlUrl $crawlUrl): CrawlQueue { $urlString = (string) $crawlUrl->url; if (! isset($this->urls[$urlString])) { $crawlUrl->setId($urlString); $this->urls[$urlString] = $crawlUrl; $this->pendingUrls[$urlString] = $crawlUrl; } return $this; } public function hasPendingUrls(): bool { return (bool) $this->pendingUrls; } public function getUrlById($id): CrawlUrl { if (! isset($this->urls[$id])) { throw new UrlNotFoundByIndex("Crawl url {$id} not found in collection."); } return $this->urls[$id]; } public function hasAlreadyBeenProcessed(CrawlUrl $crawlUrl): bool { $urlString = (string) $crawlUrl->url; if (isset($this->pendingUrls[$urlString])) { return false; } if (isset($this->urls[$urlString])) { return true; } return false; } public function markAsProcessed(CrawlUrl $crawlUrl): void { $urlString = (string) $crawlUrl->url; unset($this->pendingUrls[$urlString]); } public function getProcessedUrlCount(): int { return count($this->urls) - count($this->pendingUrls); } public function has(CrawlUrl | UriInterface $crawlUrl): bool { if ($crawlUrl instanceof CrawlUrl) { $urlString = (string) $crawlUrl->url; } elseif ($crawlUrl instanceof UriInterface) { $urlString = (string) $crawlUrl; } else { throw InvalidUrl::unexpectedType($crawlUrl); } return isset($this->urls[$urlString]); } public function getPendingUrl(): ?CrawlUrl { foreach ($this->pendingUrls as $pendingUrl) { return $pendingUrl; } return null; } }