class PropertyPathBuilder

Methods

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

Creates a new property path builder.

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

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, int $pathLength)

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 line 37
__construct(null|PropertyPathInterface|string $path = null)

Creates a new property path builder.

Parameters

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

at line line 53
append(PropertyPathInterface|string $path, int $offset, int $length)

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 line 76
appendIndex(string $name)

Appends an index element to the current path.

Parameters

string $name The name of the appended index

at line line 87
appendProperty(string $name)

Appends a property element to the current path.

Parameters

string $name The name of the appended property

at line line 101
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 line 123
replace(int $offset, int $length, PropertyPathInterface|string $path, int $pathOffset, int $pathLength)

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 line 155
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 line 176
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 line 194
int getLength()

Returns the length of the current path.

Return Value

int The path length

at line line 204
PropertyPathInterface getPropertyPath()

Returns the current property path.

Return Value

PropertyPathInterface The constructed property path

at line line 216
string __toString()

Returns the current property path as string.

Return Value

string The property path as string