1 | <?php |
||
21 | class DependencyResultCollection implements \IteratorAggregate |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * The DependencyResult objects. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | private $results = []; |
||
30 | |||
31 | /** |
||
32 | * Add a result in various formats. |
||
33 | * |
||
34 | * Possible are |
||
35 | * - a DependencyResult object |
||
36 | * - any \Traversable object (in that case, the name is set to the class name of the first item) |
||
37 | * - an array of DependencyResult objects. |
||
38 | * - an array in the format |
||
39 | * [ name, entities, options] |
||
40 | * -an array in the format |
||
41 | * [ |
||
42 | * 'name' => name, |
||
43 | * 'entities' => entities, |
||
44 | * 'options' => [ ... ] |
||
45 | * ] |
||
46 | * - an array of arrays in any of the two formats above or \Traversable objects. Can be mixed. |
||
47 | * |
||
48 | * @param DependencyResult|array|\Traversable|string $name |
||
49 | * @param null|array|\Traversable $entities |
||
50 | * @param array|null $options |
||
51 | * |
||
52 | * @return DependencyResultCollection |
||
53 | */ |
||
54 | public function add($name, $entities = null, array $options = null) |
||
78 | |||
79 | /** |
||
80 | * Add a DependencyResult object. |
||
81 | * |
||
82 | * @param DependencyResult $result |
||
83 | * |
||
84 | * @return self |
||
85 | */ |
||
86 | private function addResult(DependencyResult $result) |
||
92 | |||
93 | /** |
||
94 | * Add a \Traversable object. |
||
95 | * |
||
96 | * Sets the name of the result to the class name of the first item in the object collection. |
||
97 | * Therefor, the \Traversable object must not be empty. |
||
98 | * |
||
99 | * @param \Traversable $result |
||
100 | * |
||
101 | * @return DependencyResultCollection |
||
102 | * @throws \InvalidArgumentException |
||
103 | */ |
||
104 | private function addTraversable(\Traversable $result) |
||
130 | |||
131 | /** |
||
132 | * Add an array. |
||
133 | * |
||
134 | * please see {@link add} for a list of possible values. |
||
135 | * |
||
136 | * @param array $result |
||
137 | * |
||
138 | * @return self |
||
139 | */ |
||
140 | private function addArray(array $result) |
||
176 | |||
177 | public function getIterator() |
||
181 | } |
||
182 |
It seems like you are relying on a variable being defined by an iteration: