ViolationPath
in package
implements
IteratorAggregate, PropertyPathInterface
Tags
Table of Contents
Interfaces
- IteratorAggregate
- PropertyPathInterface
- A sequence of property names or array indices.
Properties
- $elements : array<int, string>
- $isIndex : array<string|int, mixed>
- $length : int
- $mapsForm : array<string|int, mixed>
- $pathAsString : string
Methods
- __construct() : mixed
- Creates a new violation 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() : ViolationPathIterator
- 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.
- mapsForm() : bool
- Returns whether an element maps directly to a form.
- buildString() : mixed
- Builds the string representation from the elements.
Properties
$elements
private
array<int, string>
$elements
= []
$isIndex
private
array<string|int, mixed>
$isIndex
= []
$length
private
int
$length
= 0
$mapsForm
private
array<string|int, mixed>
$mapsForm
= []
$pathAsString
private
string
$pathAsString
= ''
Methods
__construct()
Creates a new violation path from a string.
public
__construct(string $violationPath) : mixed
Parameters
__toString()
Returns the string representation of the property path.
public
__toString() : string
Return values
stringgetElement()
Returns the element at the given index in the property path.
public
getElement(int $index) : string
Parameters
- $index : int
-
The index key
Return values
stringgetElements()
Returns the elements of the property path as array.
public
getElements() : array<int, string>
Return values
array<int, string>getIterator()
Returns a new iterator for this path.
public
getIterator() : ViolationPathIterator
Return values
ViolationPathIteratorgetLength()
Returns the length of the property path, i.e. the number of elements.
public
getLength() : int
Return values
intgetParent()
Returns the parent property path.
public
getParent() : self|null
Return values
self|nullisIndex()
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
boolisProperty()
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
boolmapsForm()
Returns whether an element maps directly to a form.
public
mapsForm(int $index) : bool
Consider the following violation path:
children[address].children[office].data.street
In this example, "address" and "office" map to forms, while "street does not.
Parameters
- $index : int
Tags
Return values
boolbuildString()
Builds the string representation from the elements.
private
buildString() : mixed