b374k
m1n1 1.01
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 / app / code / Glace / Lib01 / Model /
Filename/home/dev2.destoffenstraat.com/app/code/Glace/Lib01/Model/ConfigProviderAbstract.php
Size2.85 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified06-Apr-2021 18:06
Last accessed22-Aug-2025 07:20
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php
/**
* @author Glace Team
* @copyright Copyright (c) 2019 Glace (https://www.glace.com)
* @package Glace_Lib01
*/


namespace Glace\Lib01\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

/**
* @since 1.4.4
*/
abstract class ConfigProviderAbstract
{
/**
* xpath prefix of module (section)
* @var string '{section}/'
*/
protected $pathPrefix = '/';

/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;

/**
* Stored values by scopes
*
* @var array
*/
protected $data = [];

/**
* ConfigProviderAbstract constructor.
*
* @param ScopeConfigInterface $scopeConfig
*
* @throws \LogicException
*/
public function __construct(ScopeConfigInterface $scopeConfig)
{
$this->scopeConfig = $scopeConfig;
if ($this->pathPrefix === '/') {
throw new \LogicException('$pathPrefix should be declared');
}
}

/**
* clear local storage
*
* @return void
*/
public function clean()
{
$this->data = [];
}

/**
* An alias for scope config with default scope type SCOPE_STORE
*
* @param string $path '{group}/{field}'
* @param int|ScopeInterface|null $storeId Scope code
* @param string $scope
*
* @return mixed
*/
protected function getValue(
$path,
$storeId = null,
$scope = ScopeInterface::SCOPE_STORE
) {
if ($storeId instanceof \Magento\Framework\App\ScopeInterface) {
$storeId = $storeId->getId();
}
$scopeKey = $storeId;
if ($scopeKey === null) {
$scopeKey = 'current_';
}
$scopeKey .= $scope;
if (empty($this->data[$path][$scopeKey])) {
$this->data[$path][$scopeKey] = $this->scopeConfig->getValue($this->pathPrefix . $path, $scope, $storeId);
}

return $this->data[$path][$scopeKey];
}

/**
* An alias for scope config with scope type Default
*
* @param string $path '{group}/{field}'
*
* @return mixed
*/
protected function getGlobalValue($path)
{
return $this->getValue($path, null, ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
}

/**
* @param string $path '{group}/{field}'
* @param int|ScopeInterface|null $storeId
* @param string $scope
*
* @return bool
*/
protected function isSetFlag(
$path,
$storeId = null,
$scope = ScopeInterface::SCOPE_STORE
) {
return (bool)$this->getValue($path, $storeId, $scope);
}

/**
* @param string $path '{group}/{field}'
*
* @return bool
*/
protected function isSetGlobalFlag($path)
{
return $this->isSetFlag($path, null, ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
}
}