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 ScopeConfigInterface |
||
20 | */ |
||
21 | private $configReader; |
||
22 | |||
23 | /** |
||
24 | * @var WriterInterface |
||
25 | */ |
||
26 | private $configWriter; |
||
27 | |||
28 | /** |
||
29 | * @var StoreManagerInterface |
||
30 | */ |
||
31 | private $storeManager; |
||
32 | |||
33 | /** |
||
34 | * @var CacheInterface |
||
35 | */ |
||
36 | private $cache; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | private $originalConfigs = []; |
||
42 | |||
43 | public function __construct() |
||
52 | |||
53 | /** |
||
54 | * @param array $configs |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | public function changeConfigs(array $configs) |
||
77 | |||
78 | /** |
||
79 | * Revert the original configs |
||
80 | */ |
||
81 | public function revertAllConfig() |
||
86 | |||
87 | /** |
||
88 | * @param array $config |
||
89 | * |
||
90 | * @return boolean |
||
91 | */ |
||
92 | private function isValidConfig(array $config) |
||
102 | |||
103 | /** |
||
104 | * @param string $path |
||
105 | * @param mixed $value |
||
106 | * @param string $scopeType |
||
107 | * @param string $scopeCode |
||
108 | */ |
||
109 | private function changeConfig($path, $value, $scopeType, $scopeCode) |
||
115 | |||
116 | /** |
||
117 | * @param string $path |
||
118 | * @param string $value |
||
119 | * @param string $scopeType |
||
120 | * @param string $scopeCode |
||
121 | */ |
||
122 | private function storeOrigConfig($path, $value, $scopeType, $scopeCode) |
||
131 | |||
132 | /** |
||
133 | * @param string $scopeType |
||
134 | * @param string $scopeCode |
||
135 | * |
||
136 | * @return array |
||
137 | */ |
||
138 | private function getScopeIdByScopeCode($scopeType, $scopeCode) |
||
151 | |||
152 | /** |
||
153 | * @param string $scopeType |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | private function getScopesByCode($scopeType) |
||
171 | } |
||
172 |