1 | <?php |
||
29 | class SettingManager implements SettingManagerInterface |
||
30 | { |
||
31 | /** |
||
32 | * @var ObjectManager |
||
33 | */ |
||
34 | private $manager; |
||
35 | |||
36 | /** |
||
37 | * @var SettingSchemaRegistryInterface |
||
38 | */ |
||
39 | private $schemaRegistry; |
||
40 | |||
41 | /** |
||
42 | * @var SettingProviderInterface |
||
43 | */ |
||
44 | private $provider; |
||
45 | |||
46 | /** |
||
47 | * @var TypeTransformerInterface |
||
48 | */ |
||
49 | private $transformer; |
||
50 | |||
51 | /** |
||
52 | * @var SettingInterface[]|Collection |
||
53 | */ |
||
54 | private $globalSettings; |
||
55 | |||
56 | /** |
||
57 | * @var Collection |
||
58 | */ |
||
59 | private $userSettings; |
||
60 | |||
61 | public function __construct( |
||
75 | |||
76 | /** |
||
77 | * @param string $owner |
||
78 | * |
||
79 | * @return mixed|null |
||
80 | */ |
||
81 | private function getUserSettings(string $owner) |
||
89 | |||
90 | /** |
||
91 | * @param string|null $owner |
||
92 | */ |
||
93 | private function loadSettings(?string $owner) |
||
101 | |||
102 | /** |
||
103 | * @param Collection $settings |
||
104 | * @param string $section |
||
105 | * @param string $key |
||
106 | * @param string|null $owner |
||
107 | * |
||
108 | * @return Collection |
||
109 | */ |
||
110 | private function filter(Collection $settings, string $section, string $key, ?string $owner) |
||
120 | |||
121 | /** |
||
122 | * @param $section |
||
123 | * @param $key |
||
124 | * @param string|null $owner |
||
125 | * |
||
126 | * @return SettingInterface|null |
||
127 | */ |
||
128 | private function findSetting($section, $key, ?string $owner) |
||
136 | |||
137 | /** |
||
138 | * @param $section |
||
139 | * @param string|null $owner |
||
140 | */ |
||
141 | private function assertSectionScope($section, ?string $owner) |
||
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function setSetting(string $section, string $key, $value, ?string $owner = null, $autoFlush = false): void |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | public function getSetting(string $section, string $key, ?string $owner = null) |
||
187 | |||
188 | /** |
||
189 | * {@inheritdoc} |
||
190 | */ |
||
191 | public function flush(): void |
||
206 | |||
207 | /** |
||
208 | * {@inheritdoc} |
||
209 | */ |
||
210 | public function get(string $path, ?string $owner = null) |
||
220 | |||
221 | /** |
||
222 | * {@inheritdoc} |
||
223 | */ |
||
224 | public function set(string $path, $value, ?string $owner = null): void |
||
234 | } |
||
235 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: