Documentation

Position
in package

Position in a text document expressed as zero-based line and character offset.

Table of Contents

Properties

$character  : int
Character offset on a line in a document (zero-based).
$line  : int
Line position in a document (zero-based).

Methods

__construct()  : mixed
compare()  : int
Compares this position to another position Returns - 0 if the positions match - a negative number if $this is before $position - a positive number otherwise
toOffset()  : int
Returns the offset of the position in a string

Properties

$character

Character offset on a line in a document (zero-based).

public int $character

$line

Line position in a document (zero-based).

public int $line

Methods

__construct()

public __construct([int|null $line = null ][, int|null $character = null ]) : mixed
Parameters
$line : int|null = null
$character : int|null = null

compare()

Compares this position to another position Returns - 0 if the positions match - a negative number if $this is before $position - a positive number otherwise

public compare(Position $position) : int
Parameters
$position : Position
Return values
int

toOffset()

Returns the offset of the position in a string

public toOffset(string $content) : int
Parameters
$content : string
Return values
int

        
On this page

Search results