Server : LiteSpeed System : Linux server335.web-hosting.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : cardxfeb ( 2452) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/cardxfeb/public_html/vendor/spatie/crawler/src/ |
<?php
namespace Spatie\Crawler;
use Spatie\Robots\RobotsHeaders;
use Spatie\Robots\RobotsMeta;
class CrawlerRobots
{
protected RobotsHeaders $robotsHeaders;
protected RobotsMeta $robotsMeta;
protected bool $mustRespectRobots;
public function __construct(array $headers, string $body, bool $mustRespectRobots)
{
$this->robotsHeaders = RobotsHeaders::create($headers);
$this->robotsMeta = RobotsMeta::create($body);
$this->mustRespectRobots = $mustRespectRobots;
}
public function mayIndex(): bool
{
if (! $this->mustRespectRobots) {
return true;
}
if (! $this->robotsHeaders->mayIndex()) {
return false;
}
if (! $this->robotsMeta->mayIndex()) {
return false;
}
return true;
}
public function mayFollow(): bool
{
if (! $this->mustRespectRobots) {
return true;
}
if (! $this->robotsHeaders->mayFollow()) {
return false;
}
if (! $this->robotsMeta->mayFollow()) {
return false;
}
return true;
}
}