<?php declare(strict_types = 1);
namespace zenit\PlatformShippingBar\Struct;
use Shopware\Core\Framework\Struct\Struct;
class SystemConfigData extends Struct
{
/**
* @var array
*/
protected $config = [];
/**
* @var string
*/
private $configPath = 'PlatformShippingBar.config.';
/**
* SystemConfigData constructor.
* @param array $pluginConfig
*/
public function __construct(array $pluginConfig)
{
$this->setConfig($pluginConfig);
}
/**
* @return array
*/
public function getConfig() : array
{
return $this->config;
}
/**
* @param array $config
*/
public function setConfig(array $config) : void
{
$this->config = $config;
}
/**
* @param array $pluginConfig
* @param string $key
* @param null $default
*/
public function setValue(array $pluginConfig, string $key, $default = null) : void
{
if( array_key_exists($this->configPath . $key, $pluginConfig) ) {
$this->config[$key] = $pluginConfig[$this->configPath . $key];
}
else {
$this->config[$key] = $default;
}
}
}