Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigElementFactory.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
16 {
20  private $factoryMapByConfigElementType;
21 
25  public function __construct(
26  array $factoryMapByConfigElementType
27  ) {
28  $this->factoryMapByConfigElementType = $factoryMapByConfigElementType;
29  }
30 
38  {
39  if (!isset($this->factoryMapByConfigElementType[$data['type']])) {
40  throw new \LogicException(
41  sprintf('Factory is not configured for config element of "%s" type', $data['type'])
42  );
43  }
44  return $this->factoryMapByConfigElementType[$data['type']]->createFromConfigData($data);
45  }
46 }