1 | <?php |
||
11 | class MagentoConfigManager extends BaseFixture |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $configAttributes = ['path', 'value', 'scope_type', 'scope_code']; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | private $defaultConfig = ['scope_type' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT, 'scope_code' => null]; |
||
22 | |||
23 | /** |
||
24 | * @var ScopeConfigInterface |
||
25 | */ |
||
26 | private $configReader; |
||
27 | |||
28 | /** |
||
29 | * @var WriterInterface |
||
30 | */ |
||
31 | private $configWriter; |
||
32 | |||
33 | /** |
||
34 | * @var StoreManagerInterface |
||
35 | */ |
||
36 | private $storeManager; |
||
37 | |||
38 | /** |
||
39 | * @var CacheInterface |
||
40 | */ |
||
41 | private $cache; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | private $originalConfigs = []; |
||
47 | |||
48 | public function __construct() |
||
57 | |||
58 | /** |
||
59 | * @param array $configs |
||
60 | * |
||
61 | * @return void |
||
62 | */ |
||
63 | public function changeConfigs(array $configs) |
||
74 | |||
75 | /** |
||
76 | * Revert the original configs |
||
77 | */ |
||
78 | public function revertAllConfig() |
||
83 | |||
84 | /** |
||
85 | * @param array $config |
||
86 | * |
||
87 | * @return boolean |
||
88 | */ |
||
89 | private function isValidConfig(array $config) |
||
99 | |||
100 | /** |
||
101 | * @param string $path |
||
102 | * @param mixed $value |
||
103 | * @param string $scopeType |
||
104 | * @param string $scopeCode |
||
105 | */ |
||
106 | private function changeConfig($path, $value, $scopeType, $scopeCode) |
||
112 | |||
113 | /** |
||
114 | * @param string $path |
||
115 | * @param string $value |
||
116 | * @param string $scopeType |
||
117 | * @param string $scopeCode |
||
118 | */ |
||
119 | private function storeOrigConfig($path, $value, $scopeType, $scopeCode) |
||
128 | |||
129 | /** |
||
130 | * @param string $scopeType |
||
131 | * @param string $scopeCode |
||
132 | * |
||
133 | * @return array |
||
134 | */ |
||
135 | private function getScopeIdByScopeCode($scopeType, $scopeCode) |
||
148 | |||
149 | /** |
||
150 | * @param string $scopeType |
||
151 | * |
||
152 | * @return array |
||
153 | */ |
||
154 | private function getScopesByCode($scopeType) |
||
168 | } |
||
169 |