objectManager = $objectManager; $this->instanceName = $instanceName; } /** * Create result * * @param array $arguments * @return ResultInterface * @throws LocalizedException */ public function create(array $arguments = []) { $object = $this->objectManager->create($this->instanceName, $arguments); if (!($object instanceof ResultInterface)) { throw new LocalizedException(new Phrase('This class must implement the "ResultInterface"')); } return $object; } }