aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/scssphp/source-span/src/SourceLocation.php
blob: 99792350a276f79d828620f220c3b2c3c33ab895 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

namespace SourceSpan;

use League\Uri\Contracts\UriInterface;

interface SourceLocation
{
    public function getOffset(): int;

    /**
     * The 0-based line of that location
     */
    public function getLine(): int;

    /**
     * The 0-based column of that location
     */
    public function getColumn(): int;

    public function getSourceUrl(): ?UriInterface;

    /**
     * Returns the distance in characters between $this and $other.
     *
     * This always returns a non-negative value.
     *
     * @return int<0, max>
     */
    public function distance(SourceLocation $other): int;

    /**
     * Returns a span that covers only a single point: this location.
     */
    public function pointSpan(): SourceSpan;

    /**
     * Compares two locations.
     *
     * It returns a negative integer if $this is ordered before $other,
     * a positive integer if $this is ordered after $other,
     * and zero if $this and $other are ordered together.
     *
     * $other must have the same source URL as $this.
     */
    public function compareTo(SourceLocation $other): int;
}