comparison vendor/symfony/dependency-injection/Argument/IteratorArgument.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
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\DependencyInjection\Argument;
13
14 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
15 use Symfony\Component\DependencyInjection\Reference;
16
17 /**
18 * Represents a collection of values to lazily iterate over.
19 *
20 * @author Titouan Galopin <galopintitouan@gmail.com>
21 */
22 class IteratorArgument implements ArgumentInterface
23 {
24 private $values;
25
26 /**
27 * @param Reference[] $values
28 */
29 public function __construct(array $values)
30 {
31 $this->setValues($values);
32 }
33
34 /**
35 * @return array The values to lazily iterate over
36 */
37 public function getValues()
38 {
39 return $this->values;
40 }
41
42 /**
43 * @param Reference[] $values The service references to lazily iterate over
44 */
45 public function setValues(array $values)
46 {
47 foreach ($values as $k => $v) {
48 if (null !== $v && !$v instanceof Reference) {
49 throw new InvalidArgumentException(sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', is_object($v) ? get_class($v) : gettype($v)));
50 }
51 }
52
53 $this->values = $values;
54 }
55 }