Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InputFactory.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
15 {
19  private $objectManager;
20 
24  private $prototypes;
25 
29  private $typeRegistry;
30 
35  public function __construct(
36  ObjectManagerInterface $objectManager,
37  array $prototypes
38  ) {
39  $this->objectManager = $objectManager;
40  $this->prototypes = $prototypes;
41  }
42 
47  public function create(ConfigElementInterface $configElement) : InputTypeInterface
48  {
49  if (!isset($this->typeRegistry[$configElement->getName()])) {
50  $this->typeRegistry[$configElement->getName()] =
51  $this->objectManager->create(
52  $this->prototypes[get_class($configElement)],
53  [
54  'configElement' => $configElement
55  ]
56  );
57  }
58  return $this->typeRegistry[$configElement->getName()];
59  }
60 }
$objectManager
Definition: bootstrap.php:17
create(ConfigElementInterface $configElement)
__construct(ObjectManagerInterface $objectManager, array $prototypes)