W3cubDocs

/Symfony 2.8

Symfony\Component\PropertyAccess\PropertyPathBuilder

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.

PropertyPathInterface getPropertyPath()

Returns the current property path.

string __toString()

Returns the current property path as string.

Details

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

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

public appendIndex(string $name)

Appends an index element to the current path.

Parameters

string $name The name of the appended index

public appendProperty(string $name)

Appends a property element to the current path.

Parameters

string $name The name of the appended property

public 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

public 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

public 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

public 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

public int getLength()

Returns the length of the current path.

Return Value

int The path length

public PropertyPathInterface getPropertyPath()

Returns the current property path.

Return Value

PropertyPathInterface The constructed property path

public string __toString()

Returns the current property path as string.

Return Value

string The property path as string

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.8/Symfony/Component/PropertyAccess/PropertyPathBuilder.html