Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OutputFactory.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
22  private $objectManager;
23 
27  private $prototypes;
28 
32  private $typeRegistry;
33 
38  public function __construct(
39  ObjectManagerInterface $objectManager,
40  array $prototypes
41  ) {
42  $this->objectManager = $objectManager;
43  $this->prototypes = $prototypes;
44  }
45 
52  public function create(ConfigElementInterface $configElement) : OutputTypeInterface
53  {
54  if (!isset($this->typeRegistry[$configElement->getName()])) {
55  $this->typeRegistry[$configElement->getName()] =
56  $this->objectManager->create(
57  $this->prototypes[get_class($configElement)],
58  [
59  'configElement' => $configElement
60  ]
61  );
62  }
63  return $this->typeRegistry[$configElement->getName()];
64  }
65 }
$objectManager
Definition: bootstrap.php:17
__construct(ObjectManagerInterface $objectManager, array $prototypes)
create(ConfigElementInterface $configElement)