Al-HUWAITI Shell
Al-huwaiti


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/robots-txt/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/cardxfeb/public_html/vendor/spatie/robots-txt/src/Robots.php
<?php

namespace Spatie\Robots;

class Robots
{
    protected RobotsTxt | null $robotsTxt;

    public function __construct(
        protected string | null $userAgent = null,
        string | null $source = null,
    ) {
        $this->robotsTxt = $source
            ? RobotsTxt::readFrom($source)
            : null;
    }

    public function withTxt(string $source): self
    {
        $this->robotsTxt = RobotsTxt::readFrom($source);

        return $this;
    }

    public static function create(string $userAgent = null, string $source = null): self
    {
        return new self($userAgent, $source);
    }

    public function mayIndex(string $url, string $userAgent = null): bool
    {
        $userAgent = $userAgent ?? $this->userAgent;

        $robotsTxt = $this->robotsTxt ?? RobotsTxt::create($this->createRobotsUrl($url));

        return
            $robotsTxt->allows($url, $userAgent)
            && RobotsMeta::readFrom($url)->mayIndex()
            && RobotsHeaders::readFrom($url)->mayIndex();
    }

    public function mayFollowOn(string $url): bool
    {
        return
            RobotsMeta::readFrom($url)->mayFollow()
            && RobotsHeaders::readFrom($url)->mayFollow();
    }

    protected function createRobotsUrl(string $url): string
    {
        $robotsUrl = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST);

        if ($port = parse_url($url, PHP_URL_PORT)) {
            $robotsUrl .= ":{$port}";
        }

        return "{$robotsUrl}/robots.txt";
    }
}

Al-HUWAITI Shell