ViolationPath
in package
implements
IteratorAggregate, PropertyPathInterface
Tags
Interfaces, Classes, Traits and Enums
- IteratorAggregate
- PropertyPathInterface
- A sequence of property names or array indices.
Table of Contents
- $elements : array<string|int, mixed>
- $isIndex : array<string|int, mixed>
- $length : int
- $mapsForm : array<string|int, mixed>
- $pathAsString : string
- __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<string|int, mixed>
- 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<string|int, mixed>
$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
Return values
mixed —__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(mixed $index) : string
Parameters
- $index : mixed
-
The index key
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
getIterator()
Returns a new iterator for this path.
public
getIterator() : ViolationPathIterator
Return values
ViolationPathIterator —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
Return values
self|null —The parent path or null
isIndex()
Returns whether the element at the given index is an array index.
public
isIndex(mixed $index) : bool
Parameters
- $index : mixed
-
The index in the property path
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(mixed $index) : bool
Parameters
- $index : mixed
-
The index in the property path
Return values
bool —Whether the element at this index is a property
mapsForm()
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
-
The element index
Tags
Return values
bool —Whether the element maps to a form
buildString()
Builds the string representation from the elements.
private
buildString() : mixed