ok

Mini Shell

Direktori : /home2/selectio/www/myclassicfit.com/vendor/spatie/crawler/src/CrawlProfiles/
Upload File :
Current File : /home2/selectio/www/myclassicfit.com/vendor/spatie/crawler/src/CrawlProfiles/CrawlSubdomains.php

<?php

namespace Spatie\Crawler\CrawlProfiles;

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

class CrawlSubdomains 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->isSubdomainOfHost($url);
    }

    public function isSubdomainOfHost(UriInterface $url): bool
    {
        return substr($url->getHost(), -strlen($this->baseUrl->getHost())) === $this->baseUrl->getHost();
    }
}

Zerion Mini Shell 1.0