@@ -37,7 +37,7 @@ class GeneratorPool
37
37
* @param ScheduledStructure\Helper $helper
38
38
* @param ConditionFactory $conditionFactory
39
39
* @param \Psr\Log\LoggerInterface $logger
40
- * @param array $generators
40
+ * @param array|null $generators
41
41
*/
42
42
public function __construct (
43
43
ScheduledStructure \Helper $ helper ,
@@ -67,7 +67,7 @@ public function getGenerator($type)
67
67
}
68
68
69
69
/**
70
- * Traverse through all generators and generate all scheduled elements
70
+ * Traverse through all generators and generate all scheduled elements.
71
71
*
72
72
* @param Reader\Context $readerContext
73
73
* @param Generator\Context $generatorContext
@@ -86,11 +86,17 @@ public function process(Reader\Context $readerContext, Generator\Context $genera
86
86
* Add generators to pool
87
87
*
88
88
* @param GeneratorInterface[] $generators
89
+ *
89
90
* @return void
90
91
*/
91
92
protected function addGenerators (array $ generators )
92
93
{
93
94
foreach ($ generators as $ generator ) {
95
+ if (!$ generator instanceof GeneratorInterface) {
96
+ throw new \InvalidArgumentException (
97
+ sprintf ('Generator class must be an instance of %s ' , GeneratorInterface::class)
98
+ );
99
+ }
94
100
$ this ->generators [$ generator ->getType ()] = $ generator ;
95
101
}
96
102
}
@@ -131,9 +137,9 @@ protected function buildStructure(ScheduledStructure $scheduledStructure, Data\S
131
137
}
132
138
133
139
/**
134
- * Reorder a child of a specified element
140
+ * Reorder a child of a specified element.
135
141
*
136
- * @param ScheduledStructure $scheduledStructure,
142
+ * @param ScheduledStructure $scheduledStructure
137
143
* @param Data\Structure $structure
138
144
* @param string $elementName
139
145
* @return void
@@ -227,6 +233,8 @@ protected function moveElementInStructure(
227
233
}
228
234
229
235
/**
236
+ * Check visibility conditions exists in data.
237
+ *
230
238
* @param array $data
231
239
*
232
240
* @return bool
0 commit comments