4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\PropertyAccess
;
15 * A sequence of property names or array indices.
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 interface PropertyPathInterface
extends \Traversable
22 * Returns the string representation of the property path
24 * @return string The path as string
26 public function __toString();
29 * Returns the length of the property path, i.e. the number of elements.
31 * @return integer The path length
33 public function getLength();
36 * Returns the parent property path.
38 * The parent property path is the one that contains the same items as
39 * this one except for the last one.
41 * If this property path only contains one item, null is returned.
43 * @return PropertyPath The parent path or null
45 public function getParent();
48 * Returns the elements of the property path as array
50 * @return array An array of property/index names
52 public function getElements();
55 * Returns the element at the given index in the property path
57 * @param integer $index The index key
59 * @return string A property or index name
61 * @throws Exception\OutOfBoundsException If the offset is invalid
63 public function getElement($index);
66 * Returns whether the element at the given index is a property
68 * @param integer $index The index in the property path
70 * @return Boolean Whether the element at this index is a property
72 * @throws Exception\OutOfBoundsException If the offset is invalid
74 public function isProperty($index);
77 * Returns whether the element at the given index is an array index
79 * @param integer $index The index in the property path
81 * @return Boolean Whether the element at this index is an array index
83 * @throws Exception\OutOfBoundsException If the offset is invalid
85 public function isIndex($index);