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