Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Factory.php
Go to the documentation of this file.
1 <?php
7 
10 
14 class Factory
15 {
21  protected $objectManager;
22 
29  {
30  $this->objectManager = $objectManager;
31  }
32 
40  public function create($specificationClass)
41  {
42  $specification = $this->objectManager->get($specificationClass);
43  if (!$specification instanceof SpecificationInterface) {
44  throw new \InvalidArgumentException('Specification must implement SpecificationInterface');
45  }
46  return $specification;
47  }
48 }
__construct(ObjectManagerInterface $objectManager)
Definition: Factory.php:28