PropertyPathInterface
extends
Traversable
in
A sequence of property names or array indices.
Tags
Table of Contents
- __toString() : string
- Returns the string representation of the property path.
- getElement() : string
- Returns the element at the given index in the property path.
- getElements() : array<string|int, mixed>
- Returns the elements of the property path as array.
- getLength() : int
- Returns the length of the property path, i.e. the number of elements.
- getParent() : self|null
- Returns the parent property path.
- isIndex() : bool
- Returns whether the element at the given index is an array index.
- isProperty() : bool
- Returns whether the element at the given index is a property.
Methods
__toString()
Returns the string representation of the property path.
public
__toString() : string
Return values
string —The path as string
getElement()
Returns the element at the given index in the property path.
public
getElement(int $index) : string
Parameters
- $index : int
-
The index key
Tags
Return values
string —A property or index name
getElements()
Returns the elements of the property path as array.
public
getElements() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of property/index names
getLength()
Returns the length of the property path, i.e. the number of elements.
public
getLength() : int
Return values
int —The path length
getParent()
Returns the parent property path.
public
getParent() : self|null
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 values
self|null —The parent path or null
isIndex()
Returns whether the element at the given index is an array index.
public
isIndex(int $index) : bool
Parameters
- $index : int
-
The index in the property path
Tags
Return values
bool —Whether the element at this index is an array index
isProperty()
Returns whether the element at the given index is a property.
public
isProperty(int $index) : bool
Parameters
- $index : int
-
The index in the property path
Tags
Return values
bool —Whether the element at this index is a property