]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
1 | <?php |
2 | ||
3 | /* | |
4 | * This file is part of the Symfony package. | |
5 | * | |
6 | * (c) Fabien Potencier <fabien@symfony.com> | |
7 | * | |
8 | * For the full copyright and license information, please view the LICENSE | |
9 | * file that was distributed with this source code. | |
10 | */ | |
11 | ||
12 | namespace Symfony\Component\PropertyAccess; | |
13 | ||
14 | /** | |
15 | * A sequence of property names or array indices. | |
16 | * | |
17 | * @author Bernhard Schussek <bschussek@gmail.com> | |
18 | */ | |
19 | interface PropertyPathInterface extends \Traversable | |
20 | { | |
21 | /** | |
22 | * Returns the string representation of the property path | |
23 | * | |
24 | * @return string The path as string | |
25 | */ | |
26 | public function __toString(); | |
27 | ||
28 | /** | |
29 | * Returns the length of the property path, i.e. the number of elements. | |
30 | * | |
31 | * @return integer The path length | |
32 | */ | |
33 | public function getLength(); | |
34 | ||
35 | /** | |
36 | * Returns the parent property path. | |
37 | * | |
38 | * The parent property path is the one that contains the same items as | |
39 | * this one except for the last one. | |
40 | * | |
41 | * If this property path only contains one item, null is returned. | |
42 | * | |
43 | * @return PropertyPath The parent path or null | |
44 | */ | |
45 | public function getParent(); | |
46 | ||
47 | /** | |
48 | * Returns the elements of the property path as array | |
49 | * | |
50 | * @return array An array of property/index names | |
51 | */ | |
52 | public function getElements(); | |
53 | ||
54 | /** | |
55 | * Returns the element at the given index in the property path | |
56 | * | |
57 | * @param integer $index The index key | |
58 | * | |
59 | * @return string A property or index name | |
60 | * | |
61 | * @throws Exception\OutOfBoundsException If the offset is invalid | |
62 | */ | |
63 | public function getElement($index); | |
64 | ||
65 | /** | |
66 | * Returns whether the element at the given index is a property | |
67 | * | |
68 | * @param integer $index The index in the property path | |
69 | * | |
70 | * @return Boolean Whether the element at this index is a property | |
71 | * | |
72 | * @throws Exception\OutOfBoundsException If the offset is invalid | |
73 | */ | |
74 | public function isProperty($index); | |
75 | ||
76 | /** | |
77 | * Returns whether the element at the given index is an array index | |
78 | * | |
79 | * @param integer $index The index in the property path | |
80 | * | |
81 | * @return Boolean Whether the element at this index is an array index | |
82 | * | |
83 | * @throws Exception\OutOfBoundsException If the offset is invalid | |
84 | */ | |
85 | public function isIndex($index); | |
86 | } |