PropertyPathBuilder
in package
Tags
Table of Contents
- $elements : mixed
- $isIndex : mixed
- __construct() : mixed
- Creates a new property path builder.
- __toString() : string
- Returns the current property path as string.
- append() : mixed
- Appends a (sub-) path to the current path.
- appendIndex() : mixed
- Appends an index element to the current path.
- appendProperty() : mixed
- Appends a property element to the current path.
- getLength() : int
- Returns the length of the current path.
- getPropertyPath() : PropertyPathInterface|null
- Returns the current property path.
- remove() : mixed
- Removes elements from the current path.
- replace() : mixed
- Replaces a sub-path by a different (sub-) path.
- replaceByIndex() : mixed
- Replaces a property element by an index element.
- replaceByProperty() : mixed
- Replaces an index element by a property element.
- resize() : mixed
- Resizes the path so that a chunk of length $cutLength is removed at $offset and another chunk of length $insertionLength can be inserted.
Properties
$elements
private
mixed
$elements
= []
$isIndex
private
mixed
$isIndex
= []
Methods
__construct()
Creates a new property path builder.
public
__construct([PropertyPathInterface|string|null $path = null ]) : mixed
Parameters
- $path : PropertyPathInterface|string|null = null
-
The path to initially store in the builder. Optional.
Return values
mixed —__toString()
Returns the current property path as string.
public
__toString() : string
Return values
string —The property path as string
append()
Appends a (sub-) path to the current path.
public
append(PropertyPathInterface|string $path, int $offset, int $length) : mixed
Parameters
- $path : PropertyPathInterface|string
-
The path to append
- $offset : int
-
The offset where the appended piece starts in $path
- $length : int
-
The length of the appended piece If 0, the full path is appended
Return values
mixed —appendIndex()
Appends an index element to the current path.
public
appendIndex(string $name) : mixed
Parameters
- $name : string
-
The name of the appended index
Return values
mixed —appendProperty()
Appends a property element to the current path.
public
appendProperty(string $name) : mixed
Parameters
- $name : string
-
The name of the appended property
Return values
mixed —getLength()
Returns the length of the current path.
public
getLength() : int
Return values
int —The path length
getPropertyPath()
Returns the current property path.
public
getPropertyPath() : PropertyPathInterface|null
Return values
PropertyPathInterface|null —The constructed property path
remove()
Removes elements from the current path.
public
remove(int $offset[, int $length = 1 ]) : mixed
Parameters
- $offset : int
-
The offset at which to remove
- $length : int = 1
-
The length of the removed piece
Tags
Return values
mixed —replace()
Replaces a sub-path by a different (sub-) path.
public
replace(int $offset, int $length, PropertyPathInterface|string $path, int $pathOffset, int $pathLength) : mixed
Parameters
- $offset : int
-
The offset at which to replace
- $length : int
-
The length of the piece to replace
- $path : PropertyPathInterface|string
-
The path to insert
- $pathOffset : int
-
The offset where the inserted piece starts in $path
- $pathLength : int
-
The length of the inserted piece If 0, the full path is inserted
Tags
Return values
mixed —replaceByIndex()
Replaces a property element by an index element.
public
replaceByIndex(int $offset[, string $name = null ]) : mixed
Parameters
- $offset : int
-
The offset at which to replace
- $name : string = null
-
The new name of the element. Optional
Tags
Return values
mixed —replaceByProperty()
Replaces an index element by a property element.
public
replaceByProperty(int $offset[, string $name = null ]) : mixed
Parameters
- $offset : int
-
The offset at which to replace
- $name : string = null
-
The new name of the element. Optional
Tags
Return values
mixed —resize()
Resizes the path so that a chunk of length $cutLength is removed at $offset and another chunk of length $insertionLength can be inserted.
private
resize(int $offset, int $cutLength, int $insertionLength) : mixed
Parameters
- $offset : int
- $cutLength : int
- $insertionLength : int