/** * Get minification adapter by specified content type * * @param string $contentType * @return \Magento\Framework\Code\Minifier\AdapterInterface * @throws \Magento\Framework\Exception */ protected function getAdapter($contentType) { if (!isset($this->adapters[$contentType])) { $adapterClass = $this->config->getAssetMinificationAdapter($contentType); if (!$adapterClass) { throw new \Magento\Framework\Exception("Minification adapter is not specified for '{$contentType}' content type"); } $adapter = $this->objectManager->get($adapterClass); if (!$adapter instanceof \Magento\Framework\Code\Minifier\AdapterInterface) { $type = get_class($adapter); throw new \Magento\Framework\Exception("Invalid adapter: '{$type}'. Expected: \\Magento\\Framework\\Code\\Minifier\\AdapterInterface"); } $this->adapters[$contentType] = $adapter; } return $this->adapters[$contentType]; }