Represents a source offset range.
More...
|
| __construct (?int $start, ?int $end) |
| 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 $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 () |
|
|
static | fromArray (array $sr) |
| Create a new source offset range from an array of integers (such as created during JSON serialization).
|
|
static | newFromJsonArray (array $json) |
|
static | hint () |
| JsonCodec serialization hint.
|
|
Represents a source offset range.
◆ __construct()
Wikimedia\Parsoid\Tokens\SourceRange::__construct |
( |
?int | $start, |
|
|
?int | $end ) |
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) |
◆ expandTsrK()
Wikimedia\Parsoid\Tokens\SourceRange::expandTsrK |
( |
| ) |
|
Return a KVSourceRange where this SourceRange is the key, and the value has zero length.
- Returns
- KVSourceRange
◆ expandTsrV()
Wikimedia\Parsoid\Tokens\SourceRange::expandTsrV |
( |
| ) |
|
Return a KVSourceRange where this SourceRange is the value, and the key has zero length.
- Returns
- KVSourceRange
◆ fromArray()
static Wikimedia\Parsoid\Tokens\SourceRange::fromArray |
( |
array | $sr | ) |
|
|
static |
Create a new source offset range from an array of integers (such as created during JSON serialization).
- Parameters
-
- Returns
- SourceRange
- Deprecated
◆ hint()
static Wikimedia\Parsoid\Tokens\SourceRange::hint |
( |
| ) |
|
|
static |
◆ join()
Wikimedia\Parsoid\Tokens\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\Tokens\SourceRange::length |
( |
| ) |
|
Return the length of this source range.
- Returns
- int
◆ newFromJsonArray()
static Wikimedia\Parsoid\Tokens\SourceRange::newFromJsonArray |
( |
array | $json | ) |
|
|
static |
◆ offset()
Wikimedia\Parsoid\Tokens\SourceRange::offset |
( |
int | $amount | ) |
|
◆ substr()
Wikimedia\Parsoid\Tokens\SourceRange::substr |
( |
string | $str | ) |
|
Return the substring of the given string corresponding to this range.
- Parameters
-
string | $str | The source text string |
- Returns
- string
◆ to()
Wikimedia\Parsoid\Tokens\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\Tokens\SourceRange::toJsonArray |
( |
| ) |
|
The documentation for this class was generated from the following file:
- src/Tokens/SourceRange.php