aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/property-access
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/property-access')
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitattributes2
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitignore4
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/CHANGELOG.md14
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/ExceptionInterface.php21
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/InvalidPropertyPathException.php21
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/NoSuchPropertyException.php21
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/OutOfBoundsException.php21
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/RuntimeException.php21
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.php25
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/LICENSE19
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccess.php60
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessor.php442
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php67
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorInterface.php81
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPath.php225
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathBuilder.php306
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathInterface.php86
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php55
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIteratorInterface.php34
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/README.md14
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/StringUtil.php195
-rw-r--r--vendor/symfony/property-access/Symfony/Component/PropertyAccess/composer.json31
22 files changed, 0 insertions, 1765 deletions
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitattributes b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitattributes
deleted file mode 100644
index 80481513..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
1/Tests export-ignore
2phpunit.xml.dist export-ignore
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitignore b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitignore
deleted file mode 100644
index 44de97a3..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
1vendor/
2composer.lock
3phpunit.xml
4
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/CHANGELOG.md b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/CHANGELOG.md
deleted file mode 100644
index 071ef3b5..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/CHANGELOG.md
+++ /dev/null
@@ -1,14 +0,0 @@
1CHANGELOG
2=========
3
42.3.0
5------
6
7 * added PropertyAccessorBuilder, to enable or disable the support of "__call"
8 * added support for "__call" in the PropertyAccessor (disabled by default)
9 * [BC BREAK] changed PropertyAccessor to continue its search for a property or
10 method even if a non-public match was found. Before, a PropertyAccessDeniedException
11 was thrown in this case. Class PropertyAccessDeniedException was removed
12 now.
13 * deprecated PropertyAccess::getPropertyAccessor
14 * added PropertyAccess::createPropertyAccessor and PropertyAccess::createPropertyAccessorBuilder
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/ExceptionInterface.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/ExceptionInterface.php
deleted file mode 100644
index d1fcdac9..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/ExceptionInterface.php
+++ /dev/null
@@ -1,21 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess\Exception;
13
14/**
15 * Marker interface for the PropertyAccess component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface ExceptionInterface
20{
21}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/InvalidPropertyPathException.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/InvalidPropertyPathException.php
deleted file mode 100644
index 69de31ce..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/InvalidPropertyPathException.php
+++ /dev/null
@@ -1,21 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess\Exception;
13
14/**
15 * Thrown when a property path is malformed.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class InvalidPropertyPathException extends RuntimeException
20{
21}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/NoSuchPropertyException.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/NoSuchPropertyException.php
deleted file mode 100644
index ebaa5a30..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/NoSuchPropertyException.php
+++ /dev/null
@@ -1,21 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess\Exception;
13
14/**
15 * Thrown when a property cannot be found.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class NoSuchPropertyException extends RuntimeException
20{
21}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/OutOfBoundsException.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/OutOfBoundsException.php
deleted file mode 100644
index a3c45597..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/OutOfBoundsException.php
+++ /dev/null
@@ -1,21 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess\Exception;
13
14/**
15 * Base OutOfBoundsException for the PropertyAccess component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/RuntimeException.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/RuntimeException.php
deleted file mode 100644
index 9fe843e3..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/RuntimeException.php
+++ /dev/null
@@ -1,21 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess\Exception;
13
14/**
15 * Base RuntimeException for the PropertyAccess component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class RuntimeException extends \RuntimeException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.php
deleted file mode 100644
index 029d48c2..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/Exception/UnexpectedTypeException.php
+++ /dev/null
@@ -1,25 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess\Exception;
13
14/**
15 * Thrown when a value does not match an expected type.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class UnexpectedTypeException extends RuntimeException
20{
21 public function __construct($value, $expectedType)
22 {
23 parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
24 }
25}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/LICENSE b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/LICENSE
deleted file mode 100644
index 88a57f8d..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
1Copyright (c) 2004-2013 Fabien Potencier
2
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal
5in the Software without restriction, including without limitation the rights
6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7copies of the Software, and to permit persons to whom the Software is furnished
8to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19THE SOFTWARE.
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccess.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccess.php
deleted file mode 100644
index 3b234df9..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccess.php
+++ /dev/null
@@ -1,60 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14/**
15 * Entry point of the PropertyAccess component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19final class PropertyAccess
20{
21 /**
22 * Creates a property accessor with the default configuration.
23 *
24 * @return PropertyAccessor The new property accessor
25 */
26 public static function createPropertyAccessor()
27 {
28 return self::createPropertyAccessorBuilder()->getPropertyAccessor();
29 }
30
31 /**
32 * Creates a property accessor builder.
33 *
34 * @return PropertyAccessorBuilder The new property accessor builder
35 */
36 public static function createPropertyAccessorBuilder()
37 {
38 return new PropertyAccessorBuilder();
39 }
40
41 /**
42 * Alias of {@link getPropertyAccessor}.
43 *
44 * @return PropertyAccessor The new property accessor
45 *
46 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
47 * {@link createPropertyAccessor()} instead.
48 */
49 public static function getPropertyAccessor()
50 {
51 return self::createPropertyAccessor();
52 }
53
54 /**
55 * This class cannot be instantiated.
56 */
57 private function __construct()
58 {
59 }
60}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessor.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessor.php
deleted file mode 100644
index c65d919e..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessor.php
+++ /dev/null
@@ -1,442 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
15use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
16
17/**
18 * Default implementation of {@link PropertyAccessorInterface}.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class PropertyAccessor implements PropertyAccessorInterface
23{
24 const VALUE = 0;
25 const IS_REF = 1;
26
27 private $magicCall;
28
29 /**
30 * Should not be used by application code. Use
31 * {@link PropertyAccess::getPropertyAccessor()} instead.
32 */
33 public function __construct($magicCall = false)
34 {
35 $this->magicCall = $magicCall;
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function getValue($objectOrArray, $propertyPath)
42 {
43 if (is_string($propertyPath)) {
44 $propertyPath = new PropertyPath($propertyPath);
45 } elseif (!$propertyPath instanceof PropertyPathInterface) {
46 throw new UnexpectedTypeException($propertyPath, 'string or Symfony\Component\PropertyAccess\PropertyPathInterface');
47 }
48
49 $propertyValues =& $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength());
50
51 return $propertyValues[count($propertyValues) - 1][self::VALUE];
52 }
53
54 /**
55 * {@inheritdoc}
56 */
57 public function setValue(&$objectOrArray, $propertyPath, $value)
58 {
59 if (is_string($propertyPath)) {
60 $propertyPath = new PropertyPath($propertyPath);
61 } elseif (!$propertyPath instanceof PropertyPathInterface) {
62 throw new UnexpectedTypeException($propertyPath, 'string or Symfony\Component\PropertyAccess\PropertyPathInterface');
63 }
64
65 $propertyValues =& $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
66 $overwrite = true;
67
68 // Add the root object to the list
69 array_unshift($propertyValues, array(
70 self::VALUE => &$objectOrArray,
71 self::IS_REF => true,
72 ));
73
74 for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
75 $objectOrArray =& $propertyValues[$i][self::VALUE];
76
77 if ($overwrite) {
78 if (!is_object($objectOrArray) && !is_array($objectOrArray)) {
79 throw new UnexpectedTypeException($objectOrArray, 'object or array');
80 }
81
82 $property = $propertyPath->getElement($i);
83 //$singular = $propertyPath->singulars[$i];
84 $singular = null;
85
86 if ($propertyPath->isIndex($i)) {
87 $this->writeIndex($objectOrArray, $property, $value);
88 } else {
89 $this->writeProperty($objectOrArray, $property, $singular, $value);
90 }
91 }
92
93 $value =& $objectOrArray;
94 $overwrite = !$propertyValues[$i][self::IS_REF];
95 }
96 }
97
98 /**
99 * Reads the path from an object up to a given path index.
100 *
101 * @param object|array $objectOrArray The object or array to read from
102 * @param PropertyPathInterface $propertyPath The property path to read
103 * @param integer $lastIndex The index up to which should be read
104 *
105 * @return array The values read in the path.
106 *
107 * @throws UnexpectedTypeException If a value within the path is neither object nor array.
108 */
109 private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $propertyPath, $lastIndex)
110 {
111 $propertyValues = array();
112
113 for ($i = 0; $i < $lastIndex; ++$i) {
114 if (!is_object($objectOrArray) && !is_array($objectOrArray)) {
115 throw new UnexpectedTypeException($objectOrArray, 'object or array');
116 }
117
118 $property = $propertyPath->getElement($i);
119 $isIndex = $propertyPath->isIndex($i);
120 $isArrayAccess = is_array($objectOrArray) || $objectOrArray instanceof \ArrayAccess;
121
122 // Create missing nested arrays on demand
123 if ($isIndex && $isArrayAccess && !isset($objectOrArray[$property])) {
124 $objectOrArray[$property] = $i + 1 < $propertyPath->getLength() ? array() : null;
125 }
126
127 if ($isIndex) {
128 $propertyValue =& $this->readIndex($objectOrArray, $property);
129 } else {
130 $propertyValue =& $this->readProperty($objectOrArray, $property);
131 }
132
133 $objectOrArray =& $propertyValue[self::VALUE];
134
135 $propertyValues[] =& $propertyValue;
136 }
137
138 return $propertyValues;
139 }
140
141 /**
142 * Reads a key from an array-like structure.
143 *
144 * @param \ArrayAccess|array $array The array or \ArrayAccess object to read from
145 * @param string|integer $index The key to read
146 *
147 * @return mixed The value of the key
148 *
149 * @throws NoSuchPropertyException If the array does not implement \ArrayAccess or it is not an array
150 */
151 private function &readIndex(&$array, $index)
152 {
153 if (!$array instanceof \ArrayAccess && !is_array($array)) {
154 throw new NoSuchPropertyException(sprintf('Index "%s" cannot be read from object of type "%s" because it doesn\'t implement \ArrayAccess', $index, get_class($array)));
155 }
156
157 // Use an array instead of an object since performance is very crucial here
158 $result = array(
159 self::VALUE => null,
160 self::IS_REF => false
161 );
162
163 if (isset($array[$index])) {
164 if (is_array($array)) {
165 $result[self::VALUE] =& $array[$index];
166 $result[self::IS_REF] = true;
167 } else {
168 $result[self::VALUE] = $array[$index];
169 // Objects are always passed around by reference
170 $result[self::IS_REF] = is_object($array[$index]) ? true : false;
171 }
172 }
173
174 return $result;
175 }
176
177 /**
178 * Reads the a property from an object or array.
179 *
180 * @param object $object The object to read from.
181 * @param string $property The property to read.
182 *
183 * @return mixed The value of the read property
184 *
185 * @throws NoSuchPropertyException If the property does not exist or is not
186 * public.
187 */
188 private function &readProperty(&$object, $property)
189 {
190 // Use an array instead of an object since performance is
191 // very crucial here
192 $result = array(
193 self::VALUE => null,
194 self::IS_REF => false
195 );
196
197 if (!is_object($object)) {
198 throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you should write the property path as "[%s]" instead?', $property, $property));
199 }
200
201 $camelProp = $this->camelize($property);
202 $reflClass = new \ReflectionClass($object);
203 $getter = 'get'.$camelProp;
204 $isser = 'is'.$camelProp;
205 $hasser = 'has'.$camelProp;
206 $classHasProperty = $reflClass->hasProperty($property);
207
208 if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) {
209 $result[self::VALUE] = $object->$getter();
210 } elseif ($reflClass->hasMethod($isser) && $reflClass->getMethod($isser)->isPublic()) {
211 $result[self::VALUE] = $object->$isser();
212 } elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) {
213 $result[self::VALUE] = $object->$hasser();
214 } elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) {
215 $result[self::VALUE] = $object->$property;
216 } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
217 $result[self::VALUE] =& $object->$property;
218 $result[self::IS_REF] = true;
219 } elseif (!$classHasProperty && property_exists($object, $property)) {
220 // Needed to support \stdClass instances. We need to explicitly
221 // exclude $classHasProperty, otherwise if in the previous clause
222 // a *protected* property was found on the class, property_exists()
223 // returns true, consequently the following line will result in a
224 // fatal error.
225 $result[self::VALUE] =& $object->$property;
226 $result[self::IS_REF] = true;
227 } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) {
228 // we call the getter and hope the __call do the job
229 $result[self::VALUE] = $object->$getter();
230 } else {
231 throw new NoSuchPropertyException(sprintf(
232 'Neither the property "%s" nor one of the methods "%s()", '.
233 '"%s()", "%s()", "__get()" or "__call()" exist and have public access in '.
234 'class "%s".',
235 $property,
236 $getter,
237 $isser,
238 $hasser,
239 $reflClass->name
240 ));
241 }
242
243 // Objects are always passed around by reference
244 if (is_object($result[self::VALUE])) {
245 $result[self::IS_REF] = true;
246 }
247
248 return $result;
249 }
250
251 /**
252 * Sets the value of the property at the given index in the path
253 *
254 * @param \ArrayAccess|array $array An array or \ArrayAccess object to write to
255 * @param string|integer $index The index to write at
256 * @param mixed $value The value to write
257 *
258 * @throws NoSuchPropertyException If the array does not implement \ArrayAccess or it is not an array
259 */
260 private function writeIndex(&$array, $index, $value)
261 {
262 if (!$array instanceof \ArrayAccess && !is_array($array)) {
263 throw new NoSuchPropertyException(sprintf('Index "%s" cannot be modified in object of type "%s" because it doesn\'t implement \ArrayAccess', $index, get_class($array)));
264 }
265
266 $array[$index] = $value;
267 }
268
269 /**
270 * Sets the value of the property at the given index in the path
271 *
272 * @param object|array $object The object or array to write to
273 * @param string $property The property to write
274 * @param string|null $singular The singular form of the property name or null
275 * @param mixed $value The value to write
276 *
277 * @throws NoSuchPropertyException If the property does not exist or is not
278 * public.
279 */
280 private function writeProperty(&$object, $property, $singular, $value)
281 {
282 $guessedAdders = '';
283
284 if (!is_object($object)) {
285 throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%s]" instead?', $property, $property));
286 }
287
288 $reflClass = new \ReflectionClass($object);
289 $plural = $this->camelize($property);
290
291 // Any of the two methods is required, but not yet known
292 $singulars = null !== $singular ? array($singular) : (array) StringUtil::singularify($plural);
293
294 if (is_array($value) || $value instanceof \Traversable) {
295 $methods = $this->findAdderAndRemover($reflClass, $singulars);
296
297 if (null !== $methods) {
298 // At this point the add and remove methods have been found
299 // Use iterator_to_array() instead of clone in order to prevent side effects
300 // see https://github.com/symfony/symfony/issues/4670
301 $itemsToAdd = is_object($value) ? iterator_to_array($value) : $value;
302 $itemToRemove = array();
303 $propertyValue = $this->readProperty($object, $property);
304 $previousValue = $propertyValue[self::VALUE];
305
306 if (is_array($previousValue) || $previousValue instanceof \Traversable) {
307 foreach ($previousValue as $previousItem) {
308 foreach ($value as $key => $item) {
309 if ($item === $previousItem) {
310 // Item found, don't add
311 unset($itemsToAdd[$key]);
312
313 // Next $previousItem
314 continue 2;
315 }
316 }
317
318 // Item not found, add to remove list
319 $itemToRemove[] = $previousItem;
320 }
321 }
322
323 foreach ($itemToRemove as $item) {
324 call_user_func(array($object, $methods[1]), $item);
325 }
326
327 foreach ($itemsToAdd as $item) {
328 call_user_func(array($object, $methods[0]), $item);
329 }
330
331 return;
332 } else {
333 // It is sufficient to include only the adders in the error
334 // message. If the user implements the adder but not the remover,
335 // an exception will be thrown in findAdderAndRemover() that
336 // the remover has to be implemented as well.
337 $guessedAdders = '"add'.implode('()", "add', $singulars).'()", ';
338 }
339 }
340
341 $setter = 'set'.$this->camelize($property);
342 $classHasProperty = $reflClass->hasProperty($property);
343
344 if ($reflClass->hasMethod($setter) && $reflClass->getMethod($setter)->isPublic()) {
345 $object->$setter($value);
346 } elseif ($reflClass->hasMethod('__set') && $reflClass->getMethod('__set')->isPublic()) {
347 $object->$property = $value;
348 } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
349 $object->$property = $value;
350 } elseif (!$classHasProperty && property_exists($object, $property)) {
351 // Needed to support \stdClass instances. We need to explicitly
352 // exclude $classHasProperty, otherwise if in the previous clause
353 // a *protected* property was found on the class, property_exists()
354 // returns true, consequently the following line will result in a
355 // fatal error.
356 $object->$property = $value;
357 } elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) {
358 // we call the getter and hope the __call do the job
359 $object->$setter($value);
360 } else {
361 throw new NoSuchPropertyException(sprintf(
362 'Neither the property "%s" nor one of the methods %s"%s()", '.
363 '"__set()" or "__call()" exist and have public access in class "%s".',
364 $property,
365 $guessedAdders,
366 $setter,
367 $reflClass->name
368 ));
369 }
370 }
371
372 /**
373 * Camelizes a given string.
374 *
375 * @param string $string Some string
376 *
377 * @return string The camelized version of the string
378 */
379 private function camelize($string)
380 {
381 return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $string);
382 }
383
384 /**
385 * Searches for add and remove methods.
386 *
387 * @param \ReflectionClass $reflClass The reflection class for the given object
388 * @param array $singulars The singular form of the property name or null
389 *
390 * @return array|null An array containing the adder and remover when found, null otherwise
391 *
392 * @throws NoSuchPropertyException If the property does not exist
393 */
394 private function findAdderAndRemover(\ReflectionClass $reflClass, array $singulars)
395 {
396 foreach ($singulars as $singular) {
397 $addMethod = 'add'.$singular;
398 $removeMethod = 'remove'.$singular;
399
400 $addMethodFound = $this->isAccessible($reflClass, $addMethod, 1);
401 $removeMethodFound = $this->isAccessible($reflClass, $removeMethod, 1);
402
403 if ($addMethodFound && $removeMethodFound) {
404 return array($addMethod, $removeMethod);
405 }
406
407 if ($addMethodFound xor $removeMethodFound) {
408 throw new NoSuchPropertyException(sprintf(
409 'Found the public method "%s()", but did not find a public "%s()" on class %s',
410 $addMethodFound ? $addMethod : $removeMethod,
411 $addMethodFound ? $removeMethod : $addMethod,
412 $reflClass->name
413 ));
414 }
415 }
416
417 return null;
418 }
419
420 /**
421 * Returns whether a method is public and has a specific number of required parameters.
422 *
423 * @param \ReflectionClass $class The class of the method
424 * @param string $methodName The method name
425 * @param integer $parameters The number of parameters
426 *
427 * @return Boolean Whether the method is public and has $parameters
428 * required parameters
429 */
430 private function isAccessible(\ReflectionClass $class, $methodName, $parameters)
431 {
432 if ($class->hasMethod($methodName)) {
433 $method = $class->getMethod($methodName);
434
435 if ($method->isPublic() && $method->getNumberOfRequiredParameters() === $parameters) {
436 return true;
437 }
438 }
439
440 return false;
441 }
442}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php
deleted file mode 100644
index 25686e95..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorBuilder.php
+++ /dev/null
@@ -1,67 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14/**
15 * A configurable builder for PropertyAccessorInterface objects.
16 *
17 * @author Jérémie Augustin <jeremie.augustin@pixel-cookers.com>
18 */
19class PropertyAccessorBuilder
20{
21 /**
22 * @var Boolean
23 */
24 private $magicCall = false;
25
26 /**
27 * Enables the use of "__call" by the ProperyAccessor.
28 *
29 * @return PropertyAccessorBuilder The builder object
30 */
31 public function enableMagicCall()
32 {
33 $this->magicCall = true;
34
35 return $this;
36 }
37
38 /**
39 * Disables the use of "__call" by the ProperyAccessor.
40 *
41 * @return PropertyAccessorBuilder The builder object
42 */
43 public function disableMagicCall()
44 {
45 $this->magicCall = false;
46
47 return $this;
48 }
49
50 /**
51 * @return Boolean true if the use of "__call" by the ProperyAccessor is enabled
52 */
53 public function isMagicCallEnabled()
54 {
55 return $this->magicCall;
56 }
57
58 /**
59 * Builds and returns a new propertyAccessor object.
60 *
61 * @return PropertyAccessorInterface The built propertyAccessor
62 */
63 public function getPropertyAccessor()
64 {
65 return new PropertyAccessor($this->magicCall);
66 }
67}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorInterface.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorInterface.php
deleted file mode 100644
index 1eed7c7b..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyAccessorInterface.php
+++ /dev/null
@@ -1,81 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14/**
15 * Writes and reads values to/from an object/array graph.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface PropertyAccessorInterface
20{
21 /**
22 * Sets the value at the end of the property path of the object
23 *
24 * Example:
25 *
26 * use Symfony\Component\PropertyAccess\PropertyAccess;
27 *
28 * $propertyAccessor = PropertyAccess::getPropertyAccessor();
29 *
30 * echo $propertyAccessor->setValue($object, 'child.name', 'Fabien');
31 * // equals echo $object->getChild()->setName('Fabien');
32 *
33 * This method first tries to find a public setter for each property in the
34 * path. The name of the setter must be the camel-cased property name
35 * prefixed with "set".
36 *
37 * If the setter does not exist, this method tries to find a public
38 * property. The value of the property is then changed.
39 *
40 * If neither is found, an exception is thrown.
41 *
42 * @param object|array $objectOrArray The object or array to modify
43 * @param string|PropertyPathInterface $propertyPath The property path to modify
44 * @param mixed $value The value to set at the end of the property path
45 *
46 * @throws Exception\NoSuchPropertyException If a property does not exist or is not public.
47 * @throws Exception\UnexpectedTypeException If a value within the path is neither object
48 * nor array
49 */
50 public function setValue(&$objectOrArray, $propertyPath, $value);
51
52 /**
53 * Returns the value at the end of the property path of the object
54 *
55 * Example:
56 *
57 * use Symfony\Component\PropertyAccess\PropertyAccess;
58 *
59 * $propertyAccessor = PropertyAccess::getPropertyAccessor();
60 *
61 * echo $propertyAccessor->getValue($object, 'child.name);
62 * // equals echo $object->getChild()->getName();
63 *
64 * This method first tries to find a public getter for each property in the
65 * path. The name of the getter must be the camel-cased property name
66 * prefixed with "get", "is", or "has".
67 *
68 * If the getter does not exist, this method tries to find a public
69 * property. The value of the property is then returned.
70 *
71 * If none of them are found, an exception is thrown.
72 *
73 * @param object|array $objectOrArray The object or array to traverse
74 * @param string|PropertyPathInterface $propertyPath The property path to read
75 *
76 * @return mixed The value at the end of the property path
77 *
78 * @throws Exception\NoSuchPropertyException If a property does not exist or is not public.
79 */
80 public function getValue($objectOrArray, $propertyPath);
81}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPath.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPath.php
deleted file mode 100644
index 840fc715..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPath.php
+++ /dev/null
@@ -1,225 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException;
15use Symfony\Component\PropertyAccess\Exception\OutOfBoundsException;
16use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
17
18/**
19 * Default implementation of {@link PropertyPathInterface}.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class PropertyPath implements \IteratorAggregate, PropertyPathInterface
24{
25 /**
26 * Character used for separating between plural and singular of an element.
27 * @var string
28 */
29 const SINGULAR_SEPARATOR = '|';
30
31 /**
32 * The elements of the property path
33 * @var array
34 */
35 private $elements = array();
36
37 /**
38 * The singular forms of the elements in the property path.
39 * @var array
40 */
41 private $singulars = array();
42
43 /**
44 * The number of elements in the property path
45 * @var integer
46 */
47 private $length;
48
49 /**
50 * Contains a Boolean for each property in $elements denoting whether this
51 * element is an index. It is a property otherwise.
52 * @var array
53 */
54 private $isIndex = array();
55
56 /**
57 * String representation of the path
58 * @var string
59 */
60 private $pathAsString;
61
62 /**
63 * Constructs a property path from a string.
64 *
65 * @param PropertyPath|string $propertyPath The property path as string or instance
66 *
67 * @throws UnexpectedTypeException If the given path is not a string
68 * @throws InvalidPropertyPathException If the syntax of the property path is not valid
69 */
70 public function __construct($propertyPath)
71 {
72 // Can be used as copy constructor
73 if ($propertyPath instanceof PropertyPath) {
74 /* @var PropertyPath $propertyPath */
75 $this->elements = $propertyPath->elements;
76 $this->singulars = $propertyPath->singulars;
77 $this->length = $propertyPath->length;
78 $this->isIndex = $propertyPath->isIndex;
79 $this->pathAsString = $propertyPath->pathAsString;
80
81 return;
82 }
83 if (!is_string($propertyPath)) {
84 throw new UnexpectedTypeException($propertyPath, 'string or Symfony\Component\PropertyAccess\PropertyPath');
85 }
86
87 if ('' === $propertyPath) {
88 throw new InvalidPropertyPathException('The property path should not be empty.');
89 }
90
91 $this->pathAsString = $propertyPath;
92 $position = 0;
93 $remaining = $propertyPath;
94
95 // first element is evaluated differently - no leading dot for properties
96 $pattern = '/^(([^\.\[]+)|\[([^\]]+)\])(.*)/';
97
98 while (preg_match($pattern, $remaining, $matches)) {
99 if ('' !== $matches[2]) {
100 $element = $matches[2];
101 $this->isIndex[] = false;
102 } else {
103 $element = $matches[3];
104 $this->isIndex[] = true;
105 }
106 // Disabled this behaviour as the syntax is not yet final
107 //$pos = strpos($element, self::SINGULAR_SEPARATOR);
108 $pos = false;
109 $singular = null;
110
111 if (false !== $pos) {
112 $singular = substr($element, $pos + 1);
113 $element = substr($element, 0, $pos);
114 }
115
116 $this->elements[] = $element;
117 $this->singulars[] = $singular;
118
119 $position += strlen($matches[1]);
120 $remaining = $matches[4];
121 $pattern = '/^(\.(\w+)|\[([^\]]+)\])(.*)/';
122 }
123
124 if ('' !== $remaining) {
125 throw new InvalidPropertyPathException(sprintf(
126 'Could not parse property path "%s". Unexpected token "%s" at position %d',
127 $propertyPath,
128 $remaining{0},
129 $position
130 ));
131 }
132
133 $this->length = count($this->elements);
134 }
135
136 /**
137 * {@inheritdoc}
138 */
139 public function __toString()
140 {
141 return $this->pathAsString;
142 }
143
144 /**
145 * {@inheritdoc}
146 */
147 public function getLength()
148 {
149 return $this->length;
150 }
151
152 /**
153 * {@inheritdoc}
154 */
155 public function getParent()
156 {
157 if ($this->length <= 1) {
158 return null;
159 }
160
161 $parent = clone $this;
162
163 --$parent->length;
164 $parent->pathAsString = substr($parent->pathAsString, 0, max(strrpos($parent->pathAsString, '.'), strrpos($parent->pathAsString, '[')));
165 array_pop($parent->elements);
166 array_pop($parent->singulars);
167 array_pop($parent->isIndex);
168
169 return $parent;
170 }
171
172 /**
173 * Returns a new iterator for this path
174 *
175 * @return PropertyPathIteratorInterface
176 */
177 public function getIterator()
178 {
179 return new PropertyPathIterator($this);
180 }
181
182 /**
183 * {@inheritdoc}
184 */
185 public function getElements()
186 {
187 return $this->elements;
188 }
189
190 /**
191 * {@inheritdoc}
192 */
193 public function getElement($index)
194 {
195 if (!isset($this->elements[$index])) {
196 throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index));
197 }
198
199 return $this->elements[$index];
200 }
201
202 /**
203 * {@inheritdoc}
204 */
205 public function isProperty($index)
206 {
207 if (!isset($this->isIndex[$index])) {
208 throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index));
209 }
210
211 return !$this->isIndex[$index];
212 }
213
214 /**
215 * {@inheritdoc}
216 */
217 public function isIndex($index)
218 {
219 if (!isset($this->isIndex[$index])) {
220 throw new OutOfBoundsException(sprintf('The index %s is not within the property path', $index));
221 }
222
223 return $this->isIndex[$index];
224 }
225}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathBuilder.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathBuilder.php
deleted file mode 100644
index f4eb0fb9..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathBuilder.php
+++ /dev/null
@@ -1,306 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14use Symfony\Component\PropertyAccess\Exception\OutOfBoundsException;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class PropertyPathBuilder
20{
21 /**
22 * @var array
23 */
24 private $elements = array();
25
26 /**
27 * @var array
28 */
29 private $isIndex = array();
30
31 /**
32 * Creates a new property path builder.
33 *
34 * @param null|PropertyPathInterface|string $path The path to initially store
35 * in the builder. Optional.
36 */
37 public function __construct($path = null)
38 {
39 if (null !== $path) {
40 $this->append($path);
41 }
42 }
43
44 /**
45 * Appends a (sub-) path to the current path.
46 *
47 * @param PropertyPathInterface|string $path The path to append.
48 * @param integer $offset The offset where the appended
49 * piece starts in $path.
50 * @param integer $length The length of the appended piece.
51 * If 0, the full path is appended.
52 */
53 public function append($path, $offset = 0, $length = 0)
54 {
55 if (is_string($path)) {
56 $path = new PropertyPath($path);
57 }
58
59 if (0 === $length) {
60 $end = $path->getLength();
61 } else {
62 $end = $offset + $length;
63 }
64
65 for (; $offset < $end; ++$offset) {
66 $this->elements[] = $path->getElement($offset);
67 $this->isIndex[] = $path->isIndex($offset);
68 }
69 }
70
71 /**
72 * Appends an index element to the current path.
73 *
74 * @param string $name The name of the appended index
75 */
76 public function appendIndex($name)
77 {
78 $this->elements[] = $name;
79 $this->isIndex[] = true;
80 }
81
82 /**
83 * Appends a property element to the current path.
84 *
85 * @param string $name The name of the appended property
86 */
87 public function appendProperty($name)
88 {
89 $this->elements[] = $name;
90 $this->isIndex[] = false;
91 }
92
93 /**
94 * Removes elements from the current path.
95 *
96 * @param integer $offset The offset at which to remove
97 * @param integer $length The length of the removed piece
98 *
99 * @throws OutOfBoundsException if offset is invalid
100 */
101 public function remove($offset, $length = 1)
102 {
103 if (!isset($this->elements[$offset])) {
104 throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
105 }
106
107 $this->resize($offset, $length, 0);
108 }
109
110 /**
111 * Replaces a sub-path by a different (sub-) path.
112 *
113 * @param integer $offset The offset at which to replace.
114 * @param integer $length The length of the piece to replace.
115 * @param PropertyPathInterface|string $path The path to insert.
116 * @param integer $pathOffset The offset where the inserted piece
117 * starts in $path.
118 * @param integer $pathLength The length of the inserted piece.
119 * If 0, the full path is inserted.
120 *
121 * @throws OutOfBoundsException If the offset is invalid
122 */
123 public function replace($offset, $length, $path, $pathOffset = 0, $pathLength = 0)
124 {
125 if (is_string($path)) {
126 $path = new PropertyPath($path);
127 }
128
129 if ($offset < 0 && abs($offset) <= $this->getLength()) {
130 $offset = $this->getLength() + $offset;
131 } elseif (!isset($this->elements[$offset])) {
132 throw new OutOfBoundsException('The offset ' . $offset . ' is not within the property path');
133 }
134
135 if (0 === $pathLength) {
136 $pathLength = $path->getLength() - $pathOffset;
137 }
138
139 $this->resize($offset, $length, $pathLength);
140
141 for ($i = 0; $i < $pathLength; ++$i) {
142 $this->elements[$offset + $i] = $path->getElement($pathOffset + $i);
143 $this->isIndex[$offset + $i] = $path->isIndex($pathOffset + $i);
144 }
145 }
146
147 /**
148 * Replaces a property element by an index element.
149 *
150 * @param integer $offset The offset at which to replace
151 * @param string $name The new name of the element. Optional.
152 *
153 * @throws OutOfBoundsException If the offset is invalid
154 */
155 public function replaceByIndex($offset, $name = null)
156 {
157 if (!isset($this->elements[$offset])) {
158 throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
159 }
160
161 if (null !== $name) {
162 $this->elements[$offset] = $name;
163 }
164
165 $this->isIndex[$offset] = true;
166 }
167
168 /**
169 * Replaces an index element by a property element.
170 *
171 * @param integer $offset The offset at which to replace
172 * @param string $name The new name of the element. Optional.
173 *
174 * @throws OutOfBoundsException If the offset is invalid
175 */
176 public function replaceByProperty($offset, $name = null)
177 {
178 if (!isset($this->elements[$offset])) {
179 throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));
180 }
181
182 if (null !== $name) {
183 $this->elements[$offset] = $name;
184 }
185
186 $this->isIndex[$offset] = false;
187 }
188
189 /**
190 * Returns the length of the current path.
191 *
192 * @return integer The path length
193 */
194 public function getLength()
195 {
196 return count($this->elements);
197 }
198
199 /**
200 * Returns the current property path.
201 *
202 * @return PropertyPathInterface The constructed property path
203 */
204 public function getPropertyPath()
205 {
206 $pathAsString = $this->__toString();
207
208 return '' !== $pathAsString ? new PropertyPath($pathAsString) : null;
209 }
210
211 /**
212 * Returns the current property path as string.
213 *
214 * @return string The property path as string
215 */
216 public function __toString()
217 {
218 $string = '';
219
220 foreach ($this->elements as $offset => $element) {
221 if ($this->isIndex[$offset]) {
222 $element = '['.$element.']';
223 } elseif ('' !== $string) {
224 $string .= '.';
225 }
226
227 $string .= $element;
228 }
229
230 return $string;
231 }
232
233 /**
234 * Resizes the path so that a chunk of length $cutLength is
235 * removed at $offset and another chunk of length $insertionLength
236 * can be inserted.
237 *
238 * @param integer $offset The offset where the removed chunk starts
239 * @param integer $cutLength The length of the removed chunk
240 * @param integer $insertionLength The length of the inserted chunk
241 */
242 private function resize($offset, $cutLength, $insertionLength)
243 {
244 // Nothing else to do in this case
245 if ($insertionLength === $cutLength) {
246 return;
247 }
248
249 $length = count($this->elements);
250
251 if ($cutLength > $insertionLength) {
252 // More elements should be removed than inserted
253 $diff = $cutLength - $insertionLength;
254 $newLength = $length - $diff;
255
256 // Shift elements to the left (left-to-right until the new end)
257 // Max allowed offset to be shifted is such that
258 // $offset + $diff < $length (otherwise invalid index access)
259 // i.e. $offset < $length - $diff = $newLength
260 for ($i = $offset; $i < $newLength; ++$i) {
261 $this->elements[$i] = $this->elements[$i + $diff];
262 $this->isIndex[$i] = $this->isIndex[$i + $diff];
263 }
264
265 // All remaining elements should be removed
266 for (; $i < $length; ++$i) {
267 unset($this->elements[$i]);
268 unset($this->isIndex[$i]);
269 }
270 } else {
271 $diff = $insertionLength - $cutLength;
272
273 $newLength = $length + $diff;
274 $indexAfterInsertion = $offset + $insertionLength;
275
276 // $diff <= $insertionLength
277 // $indexAfterInsertion >= $insertionLength
278 // => $diff <= $indexAfterInsertion
279
280 // In each of the following loops, $i >= $diff must hold,
281 // otherwise ($i - $diff) becomes negative.
282
283 // Shift old elements to the right to make up space for the
284 // inserted elements. This needs to be done left-to-right in
285 // order to preserve an ascending array index order
286 // Since $i = max($length, $indexAfterInsertion) and $indexAfterInsertion >= $diff,
287 // $i >= $diff is guaranteed.
288 for ($i = max($length, $indexAfterInsertion); $i < $newLength; ++$i) {
289 $this->elements[$i] = $this->elements[$i - $diff];
290 $this->isIndex[$i] = $this->isIndex[$i - $diff];
291 }
292
293 // Shift remaining elements to the right. Do this right-to-left
294 // so we don't overwrite elements before copying them
295 // The last written index is the immediate index after the inserted
296 // string, because the indices before that will be overwritten
297 // anyway.
298 // Since $i >= $indexAfterInsertion and $indexAfterInsertion >= $diff,
299 // $i >= $diff is guaranteed.
300 for ($i = $length - 1; $i >= $indexAfterInsertion; --$i) {
301 $this->elements[$i] = $this->elements[$i - $diff];
302 $this->isIndex[$i] = $this->isIndex[$i - $diff];
303 }
304 }
305 }
306}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathInterface.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathInterface.php
deleted file mode 100644
index 95f34ffa..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathInterface.php
+++ /dev/null
@@ -1,86 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14/**
15 * A sequence of property names or array indices.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface 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}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php
deleted file mode 100644
index d6cd49ca..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIterator.php
+++ /dev/null
@@ -1,55 +0,0 @@
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
12namespace 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 */
20class 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}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIteratorInterface.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIteratorInterface.php
deleted file mode 100644
index cb43f8d7..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/PropertyPathIteratorInterface.php
+++ /dev/null
@@ -1,34 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17interface PropertyPathIteratorInterface extends \Iterator, \SeekableIterator
18{
19 /**
20 * Returns whether the current element in the property path is an array
21 * index.
22 *
23 * @return Boolean
24 */
25 public function isIndex();
26
27 /**
28 * Returns whether the current element in the property path is a property
29 * name.
30 *
31 * @return Boolean
32 */
33 public function isProperty();
34}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/README.md b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/README.md
deleted file mode 100644
index 0ae94e08..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
1PropertyAccess Component
2========================
3
4PropertyAccess reads/writes values from/to object/array graphs using a simple
5string notation.
6
7Resources
8---------
9
10You can run the unit tests with the following command:
11
12 $ cd path/to/Symfony/Component/PropertyAccess/
13 $ composer.phar install --dev
14 $ phpunit
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/StringUtil.php b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/StringUtil.php
deleted file mode 100644
index e782cc10..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/StringUtil.php
+++ /dev/null
@@ -1,195 +0,0 @@
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
12namespace Symfony\Component\PropertyAccess;
13
14/**
15 * Creates singulars from plurals.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class StringUtil
20{
21 /**
22 * Map english plural to singular suffixes
23 *
24 * @var array
25 *
26 * @see http://english-zone.com/spelling/plurals.html
27 * @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
28 */
29 private static $pluralMap = array(
30 // First entry: plural suffix, reversed
31 // Second entry: length of plural suffix
32 // Third entry: Whether the suffix may succeed a vocal
33 // Fourth entry: Whether the suffix may succeed a consonant
34 // Fifth entry: singular suffix, normal
35
36 // bacteria (bacterium), criteria (criterion), phenomena (phenomenon)
37 array('a', 1, true, true, array('on', 'um')),
38
39 // nebulae (nebula)
40 array('ea', 2, true, true, 'a'),
41
42 // mice (mouse), lice (louse)
43 array('eci', 3, false, true, 'ouse'),
44
45 // geese (goose)
46 array('esee', 4, false, true, 'oose'),
47
48 // fungi (fungus), alumni (alumnus), syllabi (syllabus), radii (radius)
49 array('i', 1, true, true, 'us'),
50
51 // men (man), women (woman)
52 array('nem', 3, true, true, 'man'),
53
54 // children (child)
55 array('nerdlihc', 8, true, true, 'child'),
56
57 // oxen (ox)
58 array('nexo', 4, false, false, 'ox'),
59
60 // indices (index), appendices (appendix), prices (price)
61 array('seci', 4, false, true, array('ex', 'ix', 'ice')),
62
63 // babies (baby)
64 array('sei', 3, false, true, 'y'),
65
66 // analyses (analysis), ellipses (ellipsis), funguses (fungus),
67 // neuroses (neurosis), theses (thesis), emphases (emphasis),
68 // oases (oasis), crises (crisis), houses (house), bases (base),
69 // atlases (atlas), kisses (kiss)
70 array('ses', 3, true, true, array('s', 'se', 'sis')),
71
72 // objectives (objective), alternative (alternatives)
73 array('sevit', 5, true, true, 'tive'),
74
75 // lives (life), wives (wife)
76 array('sevi', 4, false, true, 'ife'),
77
78 // hooves (hoof), dwarves (dwarf), elves (elf), leaves (leaf)
79 array('sev', 3, true, true, 'f'),
80
81 // axes (axis), axes (ax), axes (axe)
82 array('sexa', 4, false, false, array('ax', 'axe', 'axis')),
83
84 // indexes (index), matrixes (matrix)
85 array('sex', 3, true, false, 'x'),
86
87 // quizzes (quiz)
88 array('sezz', 4, true, false, 'z'),
89
90 // bureaus (bureau)
91 array('suae', 4, false, true, 'eau'),
92
93 // roses (rose), garages (garage), cassettes (cassette),
94 // waltzes (waltz), heroes (hero), bushes (bush), arches (arch),
95 // shoes (shoe)
96 array('se', 2, true, true, array('', 'e')),
97
98 // tags (tag)
99 array('s', 1, true, true, ''),
100
101 // chateaux (chateau)
102 array('xuae', 4, false, true, 'eau'),
103 );
104
105 /**
106 * This class should not be instantiated
107 */
108 private function __construct() {}
109
110 /**
111 * Returns the singular form of a word
112 *
113 * If the method can't determine the form with certainty, an array of the
114 * possible singulars is returned.
115 *
116 * @param string $plural A word in plural form
117 * @return string|array The singular form or an array of possible singular
118 * forms
119 */
120 public static function singularify($plural)
121 {
122 $pluralRev = strrev($plural);
123 $lowerPluralRev = strtolower($pluralRev);
124 $pluralLength = strlen($lowerPluralRev);
125
126 // The outer loop iterates over the entries of the plural table
127 // The inner loop $j iterates over the characters of the plural suffix
128 // in the plural table to compare them with the characters of the actual
129 // given plural suffix
130 foreach (self::$pluralMap as $map) {
131 $suffix = $map[0];
132 $suffixLength = $map[1];
133 $j = 0;
134
135 // Compare characters in the plural table and of the suffix of the
136 // given plural one by one
137 while ($suffix[$j] === $lowerPluralRev[$j]) {
138 // Let $j point to the next character
139 ++$j;
140
141 // Successfully compared the last character
142 // Add an entry with the singular suffix to the singular array
143 if ($j === $suffixLength) {
144 // Is there any character preceding the suffix in the plural string?
145 if ($j < $pluralLength) {
146 $nextIsVocal = false !== strpos('aeiou', $lowerPluralRev[$j]);
147
148 if (!$map[2] && $nextIsVocal) {
149 // suffix may not succeed a vocal but next char is one
150 break;
151 }
152
153 if (!$map[3] && !$nextIsVocal) {
154 // suffix may not succeed a consonant but next char is one
155 break;
156 }
157 }
158
159 $newBase = substr($plural, 0, $pluralLength - $suffixLength);
160 $newSuffix = $map[4];
161
162 // Check whether the first character in the plural suffix
163 // is uppercased. If yes, uppercase the first character in
164 // the singular suffix too
165 $firstUpper = ctype_upper($pluralRev[$j - 1]);
166
167 if (is_array($newSuffix)) {
168 $singulars = array();
169
170 foreach ($newSuffix as $newSuffixEntry) {
171 $singulars[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
172 }
173
174 return $singulars;
175 }
176
177 return $newBase.($firstUpper ? ucFirst($newSuffix) : $newSuffix);
178 }
179
180 // Suffix is longer than word
181 if ($j === $pluralLength) {
182 break;
183 }
184 }
185 }
186
187 // Convert teeth to tooth, feet to foot
188 if (false !== ($pos = strpos($plural, 'ee'))) {
189 return substr_replace($plural, 'oo', $pos, 2);
190 }
191
192 // Assume that plural and singular is identical
193 return $plural;
194 }
195}
diff --git a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/composer.json b/vendor/symfony/property-access/Symfony/Component/PropertyAccess/composer.json
deleted file mode 100644
index 31860427..00000000
--- a/vendor/symfony/property-access/Symfony/Component/PropertyAccess/composer.json
+++ /dev/null
@@ -1,31 +0,0 @@
1{
2 "name": "symfony/property-access",
3 "type": "library",
4 "description": "Symfony PropertyAccess Component",
5 "keywords": ["property", "index", "access", "object", "array", "extraction", "injection", "reflection", "property path"],
6 "homepage": "http://symfony.com",
7 "license": "MIT",
8 "authors": [
9 {
10 "name": "Fabien Potencier",
11 "email": "fabien@symfony.com"
12 },
13 {
14 "name": "Symfony Community",
15 "homepage": "http://symfony.com/contributors"
16 }
17 ],
18 "require": {
19 "php": ">=5.3.3"
20 },
21 "autoload": {
22 "psr-0": { "Symfony\\Component\\PropertyAccess\\": "" }
23 },
24 "target-dir": "Symfony/Component/PropertyAccess",
25 "minimum-stability": "dev",
26 "extra": {
27 "branch-alias": {
28 "dev-master": "2.3-dev"
29 }
30 }
31}