Represents a source offset range.
More...
|
| | __construct (?int $start, ?int $end, ?Source $source=null) |
| | Create a new source offset range.
|
| |
| | expandTsrK () |
| | Return a KVSourceRange where this SourceRange is the key, and the value has zero length.
|
| |
| | expandTsrV () |
| | Return a KVSourceRange where this SourceRange is the value, and the key has zero length.
|
| |
| | join (SourceRange $value) |
| | Return a KVSourceRange by using this SourceRange for the key and the given SourceRange parameter for the value.
|
| |
| | substr (string|Source ... $str) |
| | Return the substring of the given string corresponding to this range.
|
| |
| | offset (int $amount) |
| | Return a new source range shifted by $amount.
|
| |
| | to (SourceRange $sr) |
| | Return a range from the end of this range to the start of the given range.
|
| |
| | length () |
| | Return the length of this source range.
|
| |
| | toJsonArray () |
| |
|
| | getSourceString (array $args) |
| | Helper function to turn an optional string|Source argument into a source string.
|
| |
Represents a source offset range.
◆ __construct()
| Wikimedia\Parsoid\Core\SourceRange::__construct |
( |
?int | $start, |
|
|
?int | $end, |
|
|
?Source | $source = null ) |
Create a new source offset range.
- Parameters
-
| ?int | $start | The starting index (UTF-8 byte count, inclusive) |
| ?int | $end | The ending index (UTF-8 byte count, exclusive) |
| ?Source | $source | |
◆ expandTsrK()
| Wikimedia\Parsoid\Core\SourceRange::expandTsrK |
( |
| ) |
|
Return a KVSourceRange where this SourceRange is the key, and the value has zero length.
- Returns
- KVSourceRange
◆ expandTsrV()
| Wikimedia\Parsoid\Core\SourceRange::expandTsrV |
( |
| ) |
|
Return a KVSourceRange where this SourceRange is the value, and the key has zero length.
- Returns
- KVSourceRange
◆ fromSource()
| static Wikimedia\Parsoid\Core\SourceRange::fromSource |
( |
Source | $source | ) |
|
|
static |
◆ getSourceString()
| Wikimedia\Parsoid\Core\SourceRange::getSourceString |
( |
array | $args | ) |
|
|
protected |
Helper function to turn an optional string|Source argument into a source string.
- Parameters
-
| array{0:string|Source} | $args |
- Returns
- string
◆ hint()
| static Wikimedia\Parsoid\Core\SourceRange::hint |
( |
| ) |
|
|
static |
◆ join()
| Wikimedia\Parsoid\Core\SourceRange::join |
( |
SourceRange | $value | ) |
|
Return a KVSourceRange by using this SourceRange for the key and the given SourceRange parameter for the value.
- Parameters
-
- Returns
- KVSourceRange
◆ length()
| Wikimedia\Parsoid\Core\SourceRange::length |
( |
| ) |
|
Return the length of this source range.
- Returns
- int
◆ newFromJsonArray()
| static Wikimedia\Parsoid\Core\SourceRange::newFromJsonArray |
( |
array | $json | ) |
|
|
static |
◆ offset()
| Wikimedia\Parsoid\Core\SourceRange::offset |
( |
int | $amount | ) |
|
◆ substr()
| Wikimedia\Parsoid\Core\SourceRange::substr |
( |
string|Source ... | $str | ) |
|
Return the substring of the given string corresponding to this range.
- Parameters
-
| string|Source | ...$str The source text string (optional) The Source of this object (if non-null) is preferred over the given argument. |
- Returns
- string
◆ to()
| Wikimedia\Parsoid\Core\SourceRange::to |
( |
SourceRange | $sr | ) |
|
Return a range from the end of this range to the start of the given range.
- Parameters
-
- Returns
- SourceRange
◆ toJsonArray()
| Wikimedia\Parsoid\Core\SourceRange::toJsonArray |
( |
| ) |
|
◆ $source
| Source Wikimedia\Parsoid\Core\SourceRange::$source |
The "source text" for this range.
Optional for now because (a) we're retrofitting this into existing code, and (b) we don't have a way to serialize this yet so in html2wt contexts this will typically be null (T405759).
The documentation for this class was generated from the following file: