MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/lead_cafsinfotech_in/vendor/webonyx/graphql-php/src/Language/AST/Location.php
<?php declare(strict_types=1);

namespace GraphQL\Language\AST;

use GraphQL\Language\Source;
use GraphQL\Language\Token;

/**
 * Contains a range of UTF-8 character offsets and token references that
 * identify the region of the source from which the AST derived.
 *
 * @phpstan-type LocationArray array{start: int, end: int}
 */
class Location
{
    /** The character offset at which this Node begins. */
    public int $start;

    /** The character offset at which this Node ends. */
    public int $end;

    /** The Token at which this Node begins. */
    public ?Token $startToken = null;

    /** The Token at which this Node ends. */
    public ?Token $endToken = null;

    /** The Source document the AST represents. */
    public ?Source $source = null;

    public static function create(int $start, int $end): self
    {
        $tmp = new static();

        $tmp->start = $start;
        $tmp->end = $end;

        return $tmp;
    }

    public function __construct(?Token $startToken = null, ?Token $endToken = null, ?Source $source = null)
    {
        $this->startToken = $startToken;
        $this->endToken = $endToken;
        $this->source = $source;

        if ($startToken === null || $endToken === null) {
            return;
        }

        $this->start = $startToken->start;
        $this->end = $endToken->end;
    }

    /** @return LocationArray */
    public function toArray(): array
    {
        return [
            'start' => $this->start,
            'end' => $this->end,
        ];
    }
}