|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / vendor / magento / framework / View / Asset / Bundle / |
Filename | /home/dev2.destoffenstraat.com/vendor/magento/framework/View/Asset/Bundle/Config.php |
Size | 3.04 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 07-Jan-2021 21:08 |
Last accessed | 23-Aug-2025 03:56 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View\Asset\Bundle;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View;
use Magento\Framework\View\Asset\Bundle;
use Magento\Framework\View\Design\Theme\ListInterface;
use Magento\Framework\View\Asset\File\FallbackContext;
use Magento\Framework\View\Design\Theme\ThemeProviderInterface;
/**
* Class Config
* @deprecated 101.0.0
* @see \Magento\Deploy\Config\BundleConfig
*/
class Config implements Bundle\ConfigInterface
{
/**#@+
* Bundle config info
*/
const VIEW_CONFIG_MODULE = 'Js_Bundle';
const VIEW_CONFIG_BUNDLE_SIZE_NAME = 'bundle_size';
/**#@-*/
/**#@-*/
protected $themeList;
/**
* @var View\ConfigInterface
*/
protected $viewConfig;
/**
* @var ThemeProviderInterface
*/
private $themeProvider;
/**
* @var \Magento\Framework\Config\View[]
*/
private $config = [];
/**
* @param View\ConfigInterface $viewConfig
* @param ListInterface $themeList
*/
public function __construct(
View\ConfigInterface $viewConfig,
ListInterface $themeList
) {
$this->viewConfig = $viewConfig;
$this->themeList = $themeList;
}
/**
* @param FallbackContext $assetContext
* @return bool
*/
public function isSplit(FallbackContext $assetContext)
{
return (bool)$this->getPartSize($assetContext);
}
/**
* @param FallbackContext $assetContext
* @return \Magento\Framework\Config\View
*/
public function getConfig(FallbackContext $assetContext)
{
$themePath = $assetContext->getAreaCode() . '/' . $assetContext->getThemePath();
if (!isset($this->config[$themePath])) {
$this->config[$themePath] = $this->viewConfig->getViewConfig([
'area' => $assetContext->getAreaCode(),
'themeModel' => $this->getThemeProvider()->getThemeByFullPath(
$themePath
)
]);
}
return $this->config[$themePath];
}
/**
* @param FallbackContext $assetContext
* @return int
*/
public function getPartSize(FallbackContext $assetContext)
{
$size = $this->getConfig($assetContext)->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);
}
}
/**
* @return ThemeProviderInterface
*/
private function getThemeProvider()
{
if (null === $this->themeProvider) {
$this->themeProvider = ObjectManager::getInstance()->get(ThemeProviderInterface::class);
}
return $this->themeProvider;
}
}
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View\Asset\Bundle;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View;
use Magento\Framework\View\Asset\Bundle;
use Magento\Framework\View\Design\Theme\ListInterface;
use Magento\Framework\View\Asset\File\FallbackContext;
use Magento\Framework\View\Design\Theme\ThemeProviderInterface;
/**
* Class Config
* @deprecated 101.0.0
* @see \Magento\Deploy\Config\BundleConfig
*/
class Config implements Bundle\ConfigInterface
{
/**#@+
* Bundle config info
*/
const VIEW_CONFIG_MODULE = 'Js_Bundle';
const VIEW_CONFIG_BUNDLE_SIZE_NAME = 'bundle_size';
/**#@-*/
/**#@-*/
protected $themeList;
/**
* @var View\ConfigInterface
*/
protected $viewConfig;
/**
* @var ThemeProviderInterface
*/
private $themeProvider;
/**
* @var \Magento\Framework\Config\View[]
*/
private $config = [];
/**
* @param View\ConfigInterface $viewConfig
* @param ListInterface $themeList
*/
public function __construct(
View\ConfigInterface $viewConfig,
ListInterface $themeList
) {
$this->viewConfig = $viewConfig;
$this->themeList = $themeList;
}
/**
* @param FallbackContext $assetContext
* @return bool
*/
public function isSplit(FallbackContext $assetContext)
{
return (bool)$this->getPartSize($assetContext);
}
/**
* @param FallbackContext $assetContext
* @return \Magento\Framework\Config\View
*/
public function getConfig(FallbackContext $assetContext)
{
$themePath = $assetContext->getAreaCode() . '/' . $assetContext->getThemePath();
if (!isset($this->config[$themePath])) {
$this->config[$themePath] = $this->viewConfig->getViewConfig([
'area' => $assetContext->getAreaCode(),
'themeModel' => $this->getThemeProvider()->getThemeByFullPath(
$themePath
)
]);
}
return $this->config[$themePath];
}
/**
* @param FallbackContext $assetContext
* @return int
*/
public function getPartSize(FallbackContext $assetContext)
{
$size = $this->getConfig($assetContext)->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);
}
}
/**
* @return ThemeProviderInterface
*/
private function getThemeProvider()
{
if (null === $this->themeProvider) {
$this->themeProvider = ObjectManager::getInstance()->get(ThemeProviderInterface::class);
}
return $this->themeProvider;
}
}