class PropertyPathBuilder

Methods

__construct(PropertyPathInterface|string|null $path = null)

Creates a new property path builder.

append(PropertyPathInterface|string $path, int $offset = 0, int $length = 0)

Appends a (sub-) path to the current path.

appendIndex(string $name)

Appends an index element to the current path.

appendProperty(string $name)

Appends a property element to the current path.

remove(int $offset, int $length = 1)

Removes elements from the current path.

replace(int $offset, int $length, PropertyPathInterface|string $path, int $pathOffset = 0, int $pathLength = 0)

Replaces a sub-path by a different (sub-) path.

replaceByIndex(int $offset, string $name = null)

Replaces a property element by an index element.

replaceByProperty(int $offset, string $name = null)

Replaces an index element by a property element.

int
getLength()

Returns the length of the current path.

getPropertyPath()

Returns the current property path.

string
__toString()

Returns the current property path as string.

Details

at line 30
__construct(PropertyPathInterface|string|null $path = null)

Creates a new property path builder.

Parameters

PropertyPathInterface|string|null $path The path to initially store in the builder. Optional.

at line 46
append(PropertyPathInterface|string $path, int $offset = 0, int $length = 0)

Appends a (sub-) path to the current path.

Parameters

PropertyPathInterface|string $path The path to append
int $offset The offset where the appended piece starts in $path
int $length The length of the appended piece If 0, the full path is appended

at line 69
appendIndex(string $name)

Appends an index element to the current path.

Parameters

string $name The name of the appended index

at line 80
appendProperty(string $name)

Appends a property element to the current path.

Parameters

string $name The name of the appended property

at line 94
remove(int $offset, int $length = 1)

Removes elements from the current path.

Parameters

int $offset The offset at which to remove
int $length The length of the removed piece

Exceptions

OutOfBoundsException if offset is invalid

at line 116
replace(int $offset, int $length, PropertyPathInterface|string $path, int $pathOffset = 0, int $pathLength = 0)

Replaces a sub-path by a different (sub-) path.

Parameters

int $offset The offset at which to replace
int $length The length of the piece to replace
PropertyPathInterface|string $path The path to insert
int $pathOffset The offset where the inserted piece starts in $path
int $pathLength The length of the inserted piece If 0, the full path is inserted

Exceptions

OutOfBoundsException If the offset is invalid

at line 149
replaceByIndex(int $offset, string $name = null)

Replaces a property element by an index element.

Parameters

int $offset The offset at which to replace
string $name The new name of the element. Optional

Exceptions

OutOfBoundsException If the offset is invalid

at line 170
replaceByProperty(int $offset, string $name = null)

Replaces an index element by a property element.

Parameters

int $offset The offset at which to replace
string $name The new name of the element. Optional

Exceptions

OutOfBoundsException If the offset is invalid

at line 188
int getLength()

Returns the length of the current path.

Return Value

int The path length

at line 198
PropertyPathInterface getPropertyPath()

Returns the current property path.

Return Value

PropertyPathInterface The constructed property path

at line 210
string __toString()

Returns the current property path as string.

Return Value

string The property path as string