Documentation

ViolationPath
in package
implements IteratorAggregate, 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.

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

Methods

__construct()

Creates a new violation path from a string.

public __construct(string $violationPath) : mixed
Parameters
$violationPath : string

The property path of a object

__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

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
Tags
throws
OutOfBoundsException

if the offset is invalid

Return values
bool

buildString()

Builds the string representation from the elements.

private buildString() : mixed

        
On this page

Search results