Documentation

PropertyPath
in package
implements IteratorAggregate, PropertyPathInterface

Default implementation of {@link PropertyPathInterface}.

Tags
author

Bernhard Schussek bschussek@gmail.com

implements

\IteratorAggregate<int, string>

Table of Contents

Interfaces

IteratorAggregate
PropertyPathInterface
A sequence of property names or array indices.

Constants

SINGULAR_SEPARATOR  = '|'
Character used for separating between plural and singular of an element.

Properties

$elements  : array<int, string>
The elements of the property path.
$isIndex  : array<string|int, mixed>
Contains a Boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.
$length  : int
The number of elements in the property path.
$pathAsString  : string
String representation of the path.

Methods

__construct()  : mixed
Constructs a property path from a string.
__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<int, string>
Returns the elements of the property path as array.
getIterator()  : PropertyPathIteratorInterface
Returns a new iterator for this path.
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.

Constants

SINGULAR_SEPARATOR

Character used for separating between plural and singular of an element.

public mixed SINGULAR_SEPARATOR = '|'

Properties

$elements

The elements of the property path.

private array<int, string> $elements = []

$isIndex

Contains a Boolean for each property in $elements denoting whether this element is an index. It is a property otherwise.

private array<string|int, mixed> $isIndex = []

$length

The number of elements in the property path.

private int $length

$pathAsString

String representation of the path.

private string $pathAsString

Methods

__toString()

Returns the string representation of the property path.

public __toString() : string
Return values
string

getElement()

Returns the element at the given index in the property path.

public getElement(int $index) : string
Parameters
$index : int

The index key

Return values
string

getElements()

Returns the elements of the property path as array.

public getElements() : array<int, string>
Return values
array<int, string>

getLength()

Returns the length of the property path, i.e. the number of elements.

public getLength() : int
Return values
int

getParent()

Returns the parent property path.

public getParent() : self|null
Return values
self|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

Return values
bool

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

Return values
bool

        
On this page

Search results