Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ResultFactory.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
22  protected $objectManager;
23 
29  protected $instanceName;
30 
37  public function __construct(
39  $instanceName = \Magento\Framework\View\TemplateEngine\Xhtml\ResultInterface::class
40  ) {
41  $this->objectManager = $objectManager;
42  $this->instanceName = $instanceName;
43  }
44 
52  public function create(array $arguments = [])
53  {
54  $object = $this->objectManager->create($this->instanceName, $arguments);
55 
56  if (!($object instanceof ResultInterface)) {
57  throw new LocalizedException(new Phrase('This class must implement the "ResultInterface"'));
58  }
59 
60  return $object;
61  }
62 }
__construct(ObjectManagerInterface $objectManager, $instanceName=\Magento\Framework\View\TemplateEngine\Xhtml\ResultInterface::class)
$arguments