_objectManager = $objectManager; $this->_instanceName = $instanceName; } /** * Create class instance with specified parameters * * @param array $data * @return LayoutInterface * @throws \InvalidArgumentException */ public function create(array $data = []) { $layout = $this->_objectManager->create($this->_instanceName, $data); if (!$layout instanceof LayoutInterface) { throw new \InvalidArgumentException(get_class($layout) . ' must be an instance of LayoutInterface.'); } return $layout; } }