1 | <?php |
||
24 | class PersonalSettingsManager |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | const ROLE_GRANTED = 'ROLE_ADMIN'; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | const STASH_NAME = 'ongr_settings'; |
||
35 | |||
36 | /** |
||
37 | * @var EventDispatcherInterface |
||
38 | */ |
||
39 | protected $eventDispatcher; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | private $userParam; |
||
45 | |||
46 | /** |
||
47 | * Stash name for the current user |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $stash; |
||
52 | |||
53 | /** |
||
54 | * @var AuthorizationChecker |
||
55 | */ |
||
56 | private $securityContext; |
||
57 | |||
58 | /** |
||
59 | * @var TokenStorage |
||
60 | */ |
||
61 | private $token; |
||
62 | |||
63 | /** |
||
64 | * @var SettingsStructure |
||
65 | */ |
||
66 | private $settingsStructure; |
||
67 | |||
68 | /** |
||
69 | * @var array; |
||
70 | */ |
||
71 | private $userSettings = []; |
||
72 | |||
73 | /** |
||
74 | * Stash for storing personal settings |
||
75 | * |
||
76 | * @var \Pool |
||
77 | */ |
||
78 | private $pool; |
||
79 | |||
80 | /** |
||
81 | * @param String $userParam |
||
82 | * @param SettingsStructure $settingsStructure |
||
83 | * @param EventDispatcherInterface $eventDispatcher |
||
84 | * @param AuthorizationChecker $authorization |
||
85 | * @param TokenStorage $token |
||
86 | * @param Pool $pool |
||
87 | */ |
||
88 | public function __construct($userParam, $settingsStructure, $eventDispatcher, $authorization, $token, $pool) |
||
97 | |||
98 | /** |
||
99 | * Sets settings for the current user from stash |
||
100 | */ |
||
101 | public function setSettingsFromStash() |
||
109 | |||
110 | /** |
||
111 | * @param array $settings |
||
112 | */ |
||
113 | public function setSettings(array $settings) |
||
117 | |||
118 | /** |
||
119 | * If user logged in, returns setting value from cookie. Else, returns false. |
||
120 | * |
||
121 | * @param string $settingName |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | public function getSettingEnabled($settingName) |
||
134 | |||
135 | /** |
||
136 | * Saves the current settings to stash |
||
137 | * |
||
138 | * @throws \BadMethodCallException |
||
139 | */ |
||
140 | public function save() |
||
148 | |||
149 | /** |
||
150 | * Clears the stash |
||
151 | */ |
||
152 | public function stashClear() |
||
156 | |||
157 | /** |
||
158 | * @return bool |
||
159 | */ |
||
160 | public function isAuthenticated() |
||
164 | |||
165 | /** |
||
166 | * @return array |
||
167 | */ |
||
168 | public function getSettings() |
||
172 | |||
173 | /** |
||
174 | * Gets active profiles |
||
175 | * |
||
176 | * @return array |
||
177 | */ |
||
178 | public function getActiveProfiles() |
||
190 | |||
191 | /** |
||
192 | * @return array |
||
193 | */ |
||
194 | public function getSettingsMap() |
||
198 | |||
199 | /** |
||
200 | * @return array |
||
201 | */ |
||
202 | public function getCategoryMap() |
||
206 | |||
207 | /** |
||
208 | * Returns the full name of the stash for the current |
||
209 | * User. If the unique user property value cant be determined |
||
210 | * returns false. |
||
211 | * |
||
212 | * @return string |
||
213 | */ |
||
214 | private function getStashName() |
||
218 | |||
219 | /** |
||
220 | * Gets the defined unique user setting value |
||
221 | * |
||
222 | * @return string |
||
223 | * @throws \BadMethodCallException |
||
224 | */ |
||
225 | public function getUsername() |
||
246 | |||
247 | /** |
||
248 | * Returns the property visibility and if its |
||
249 | * private, guesses the name of the getter |
||
250 | * |
||
251 | * @param $user |
||
252 | * |
||
253 | * @return array |
||
254 | */ |
||
255 | private function guessPropertyOrMethodName($user) |
||
264 | |||
265 | /** |
||
266 | * Converts a string to camel case |
||
267 | * |
||
268 | * @param string $name |
||
269 | * |
||
270 | * @return string |
||
271 | */ |
||
272 | private function toCamelCase($name) |
||
280 | } |
||
281 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..