Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CopyConstructorFactory.php
Go to the documentation of this file.
1 <?php
7 
9 {
13  protected $objectManager;
14 
19  {
20  $this->objectManager = $objectManager;
21  }
22 
31  public function create($instance, array $arguments = [])
32  {
33  if (!is_subclass_of($instance, \Magento\Catalog\Model\Product\CopyConstructorInterface::class)) {
34  throw new \InvalidArgumentException(
35  $instance . ' does not implement \Magento\Catalog\Model\Product\CopyConstructorInterface'
36  );
37  }
38 
39  return $this->objectManager->create($instance, $arguments);
40  }
41 }
is_subclass_of($obj, $className)
$arguments
__construct(\Magento\Framework\ObjectManagerInterface $objectManager)