diff options
Diffstat (limited to 'vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php')
-rw-r--r-- | vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php new file mode 100644 index 00000000..d6cd49ca --- /dev/null +++ b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php | |||
@@ -0,0 +1,55 @@ | |||
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 | * Traverses a property path and provides additional methods to find out | ||
16 | * information about the current element | ||
17 | * | ||
18 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
19 | */ | ||
20 | class PropertyPathIterator extends \ArrayIterator implements PropertyPathIteratorInterface | ||
21 | { | ||
22 | /** | ||
23 | * The traversed property path | ||
24 | * @var PropertyPathInterface | ||
25 | */ | ||
26 | protected $path; | ||
27 | |||
28 | /** | ||
29 | * Constructor. | ||
30 | * | ||
31 | * @param PropertyPathInterface $path The property path to traverse | ||
32 | */ | ||
33 | public function __construct(PropertyPathInterface $path) | ||
34 | { | ||
35 | parent::__construct($path->getElements()); | ||
36 | |||
37 | $this->path = $path; | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * {@inheritdoc} | ||
42 | */ | ||
43 | public function isIndex() | ||
44 | { | ||
45 | return $this->path->isIndex($this->key()); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * {@inheritdoc} | ||
50 | */ | ||
51 | public function isProperty() | ||
52 | { | ||
53 | return $this->path->isProperty($this->key()); | ||
54 | } | ||
55 | } | ||