W3cubDocs

/Symfony 4.1

PropertyPathBuilder

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.

PropertyPathInterface getPropertyPath()

Returns the current property path.

string __toString()

Returns the current property path as string.

Details

__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.

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

appendIndex(string $name)

Appends an index element to the current path.

Parameters

string $name The name of the appended index

appendProperty(string $name)

Appends a property element to the current path.

Parameters

string $name The name of the appended property

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

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

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

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

int getLength()

Returns the length of the current path.

Return Value

int The path length

PropertyPathInterface getPropertyPath()

Returns the current property path.

Return Value

PropertyPathInterface The constructed property path

string __toString()

Returns the current property path as string.

Return Value

string The property path as string

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/PropertyAccess/PropertyPathBuilder.html