Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Tokens\KVSourceRange Class Reference

Represents a source offset range for a key-value pair. More...

+ Inheritance diagram for Wikimedia\Parsoid\Tokens\KVSourceRange:
+ Collaboration diagram for Wikimedia\Parsoid\Tokens\KVSourceRange:

Public Member Functions

 __construct (int $keyStart, int $keyEnd, int $valueStart, int $valueEnd, ?Source $keySource=null, ?Source $valueSource=null)
 Create a new key-value source offset range.
 
 __clone ()
 
 offset (int $amount)
 Return a new key-value source offset range shifted by $amount.
 
 span ()
 Return a new source range spanning both the key and value of this KVSourceRange.
 
 toJsonArray ()
 

Static Public Member Functions

static newFromJsonArray (array $json)
 Create a new key-value source offset range from an array of integers (such as created during JSON serialization).
 

Public Attributes

SourceRange $key
 Source range for the key.
 
SourceRange $value
 Source range for the value.
 

Detailed Description

Represents a source offset range for a key-value pair.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Tokens\KVSourceRange::__construct ( int $keyStart,
int $keyEnd,
int $valueStart,
int $valueEnd,
?Source $keySource = null,
?Source $valueSource = null )

Create a new key-value source offset range.

Parameters
int$keyStartThe start index of the key (unicode code points, inclusive)
int$keyEndThe end index of the key (unicode code points, exclusive)
int$valueStartThe start index of the value (unicode code points, inclusive)
int$valueEndThe end index of the value (unicode code points, exclusive)
?Source$keySource
?Source$valueSource

Member Function Documentation

◆ newFromJsonArray()

static Wikimedia\Parsoid\Tokens\KVSourceRange::newFromJsonArray ( array $json)
static

Create a new key-value source offset range from an array of integers (such as created during JSON serialization).

Parameters
int[]$json
Returns
KVSourceRange

◆ offset()

Wikimedia\Parsoid\Tokens\KVSourceRange::offset ( int $amount)

Return a new key-value source offset range shifted by $amount.

Parameters
int$amountThe amount to shift by
Returns
KVSourceRange

The documentation for this class was generated from the following file: