PropertyPathIterator

class PropertyPathIterator extends ArrayIterator implements PropertyPathIteratorInterface Traverses a property path and provides additional methods to find out information about the current element. Methods __construct(PropertyPathInterface $path) Constructor. bool isIndex() Returns whether the current element in the property path is an array index. bool isProperty() Returns whether the current element in the property path is a property name. Details

PropertyPathInterface::isIndex()

bool isIndex(int $index) Returns whether the element at the given index is an array index. Parameters int $index The index in the property path Return Value bool Whether the element at this index is an array index Exceptions OutOfBoundsException If the offset is invalid

PropertyPathInterface::getParent()

PropertyPath getParent() Returns the parent property path. The parent property path is the one that contains the same items as this one except for the last one. If this property path only contains one item, null is returned. Return Value PropertyPath The parent path or null

PropertyPathInterface::getLength()

int getLength() Returns the length of the property path, i.e. the number of elements. Return Value int The path length

PropertyPathInterface::getElements()

array getElements() Returns the elements of the property path as array. Return Value array An array of property/index names

PropertyPathBuilder::replaceByProperty()

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

PropertyPathBuilder::replace()

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 OutOfBoundsExcep

PropertyPathBuilder::replaceByIndex()

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

PropertyPathInterface

interface PropertyPathInterface implements Traversable A sequence of property names or array indices. Methods string __toString() Returns the string representation of the property path. int getLength() Returns the length of the property path, i.e. the number of elements. PropertyPath getParent() Returns the parent property path. array getElements() Returns the elements of the property path as array. string getElement(int $index) Returns the element at the given index

PropertyPathInterface::getElement()

string getElement(int $index) Returns the element at the given index in the property path. Parameters int $index The index key Return Value string A property or index name Exceptions OutOfBoundsException If the offset is invalid