• File: CrawlInternalUrls.php
  • Full Path: /home/masbinta/public_html/core/vendor/spatie/crawler/src/CrawlInternalUrls.php
  • File size: 493 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

namespace Spatie\Crawler;

use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\UriInterface;

class CrawlInternalUrls extends CrawlProfile
{
    protected $baseUrl;

    public function __construct($baseUrl)
    {
        if (! $baseUrl instanceof UriInterface) {
            $baseUrl = new Uri($baseUrl);
        }

        $this->baseUrl = $baseUrl;
    }

    public function shouldCrawl(UriInterface $url): bool
    {
        return $this->baseUrl->getHost() === $url->getHost();
    }
}