Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ImporterFactory.php
Go to the documentation of this file.
1 <?php
7 
10 
17 {
23  private $objectManager;
24 
28  public function __construct(ObjectManagerInterface $objectManager)
29  {
30  $this->objectManager = $objectManager;
31  }
32 
41  public function create($className, array $data = [])
42  {
43  $importer = $this->objectManager->create($className, $data);
44 
45  if (!$importer instanceof ImporterInterface) {
46  throw new \InvalidArgumentException(
47  'Type "' . $className . '" is not instance of ' . ImporterInterface::class
48  );
49  }
50 
51  return $importer;
52  }
53 }
$objectManager
Definition: bootstrap.php:17
__construct(ObjectManagerInterface $objectManager)
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31