-
Notifications
You must be signed in to change notification settings - Fork 2
/
Config.php
69 lines (60 loc) · 1.79 KB
/
Config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Mollie\Multishipping;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
class Config
{
const GENERAL_MULTISHIPPING_ENABLED = 'payment/mollie_general/multishipping_enabled';
const GENERAL_MULTISHIPPING_DESCRIPTION = 'payment/mollie_general/multishipping_description';
/**
* @var ScopeConfigInterface
*/
private $config;
public function __construct(
ScopeConfigInterface $config
) {
$this->config = $config;
}
/**
* @param $path
* @param null|int|string $storeId
* @param string $scope
* @return string
*/
private function getPath($path, $storeId, $scope = ScopeInterface::SCOPE_STORE)
{
return $this->config->getValue($path, $scope, $storeId);
}
/**
* @param $path
* @param null|int|string $storeId
* @param string $scope
* @return bool
*/
private function isSetFlag($path, $storeId, $scope = ScopeInterface::SCOPE_STORE)
{
return $this->config->isSetFlag($path, $scope, $storeId);
}
/**
* @param null|int|string $storeId
* @param string $scope
* @return bool
*/
public function isMultishippingEnabled($storeId = null, $scope = ScopeInterface::SCOPE_STORE): bool
{
return $this->isSetFlag(static::GENERAL_MULTISHIPPING_ENABLED, $storeId, $scope);
}
/**
* @param null|int|string $storeId
* @param string $scope
* @return string|null
*/
public function getMultishippingDescription($storeId = null, $scope = ScopeInterface::SCOPE_STORE)
{
return $this->getPath(static::GENERAL_MULTISHIPPING_DESCRIPTION, $storeId, $scope);
}
}