viewConfig = $viewConfig; $this->themeProvider = $themeProvider; } /** * Max size of bundle files (in KB) * * @param string $area * @param string $theme * @return int */ public function getBundleFileMaxSize($area, $theme) { $size = $this->getConfig($area, $theme)->getVarValue( self::VIEW_CONFIG_MODULE, self::VIEW_CONFIG_BUNDLE_SIZE_NAME ); $unit = preg_replace('/[^a-zA-Z]+/', '', $size); $unit = strtoupper($unit); switch ($unit) { case 'KB': return (int)$size; case 'MB': return (int)$size * 1024; default: return (int)($size / 1024); } } /** * Get list of directories which must be excluded * * @param string $area * @param string $theme * @return array */ public function getExcludedDirectories($area, $theme) { return $this->getConfig($area, $theme)->getExcludedDir(); } /** * Get list of files which must be excluded from bundling * * @param string $area * @param string $theme * @return array */ public function getExcludedFiles($area, $theme) { return $this->getConfig($area, $theme)->getExcludedFiles(); } /** * Get View Configuration object related to the given area and theme * * @param string $area * @param string $theme * @return \Magento\Framework\Config\View */ private function getConfig($area, $theme) { $themePath = $area . '/' . $theme; if (!isset($this->config[$themePath])) { $this->config[$themePath] = $this->viewConfig->getViewConfig([ 'area' => $area, 'themeModel' => $this->themeProvider->getThemeByFullPath($themePath) ]); } return $this->config[$themePath]; } }