63 private $importers = [];
80 private $sortedImporters = [];
87 private $objectManager;
95 private $validatorFactory;
105 array $importers = []
108 $this->validatorFactory = $validatorFactory;
109 $this->importers = $importers;
128 return array_keys($this->importers);
147 if (!$this->sortedImporters) {
148 $sortedImporters = [];
150 foreach ($this->sort($this->importers) as $section => $importer) {
151 if (empty($importer[
'importer_class'])) {
153 __(
'The parameter "importer_class" is missing. Set the "importer_class" and try again.')
157 $sortedImporters[$section] = $importer[
'importer_class'];
160 $this->sortedImporters = $sortedImporters;
163 return $this->sortedImporters;
175 if (isset($this->importers[$section]) && !empty($this->importers[$section][
'validator_class'])) {
176 return $this->validatorFactory->create($this->importers[$section][
'validator_class']);
187 private function sort(array
$data)
189 uasort(
$data,
function (array $a, array $b) {
190 $a[
'sort_order'] = $this->getSortOrder($a);
191 $b[
'sort_order'] = $this->getSortOrder($b);
193 if ($a[
'sort_order'] == $b[
'sort_order']) {
197 return ($a[
'sort_order'] < $b[
'sort_order']) ? -1 : 1;
209 private function getSortOrder(array
$variable)
__construct(ObjectManagerInterface $objectManager, ValidatorFactory $validatorFactory, array $importers=[])