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 | * @param bool $mustAuthorize |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function getSettingEnabled($settingName, $mustAuthorize = true) |
||
138 | |||
139 | /** |
||
140 | * Saves the current settings to stash |
||
141 | * |
||
142 | * @throws \BadMethodCallException |
||
143 | */ |
||
144 | public function save() |
||
152 | |||
153 | /** |
||
154 | * Clears the stash |
||
155 | */ |
||
156 | public function stashClear() |
||
160 | |||
161 | /** |
||
162 | * @return bool |
||
163 | */ |
||
164 | public function isAuthenticated() |
||
168 | |||
169 | /** |
||
170 | * @return array |
||
171 | */ |
||
172 | public function getSettings() |
||
176 | |||
177 | /** |
||
178 | * Gets active profiles |
||
179 | * |
||
180 | * @return array |
||
181 | */ |
||
182 | public function getActiveProfiles() |
||
194 | |||
195 | /** |
||
196 | * @return array |
||
197 | */ |
||
198 | public function getSettingsMap() |
||
202 | |||
203 | /** |
||
204 | * @return array |
||
205 | */ |
||
206 | public function getCategoryMap() |
||
210 | |||
211 | /** |
||
212 | * Returns the full name of the stash for the current |
||
213 | * User. If the unique user property value cant be determined |
||
214 | * returns false. |
||
215 | * |
||
216 | * @param $user |
||
217 | * |
||
218 | * @return string |
||
219 | * @throws \BadMethodCallException |
||
220 | */ |
||
221 | private function getStashName($user) |
||
240 | |||
241 | /** |
||
242 | * Returns the property visibility and if its |
||
243 | * private, guesses the name of the getter |
||
244 | * |
||
245 | * @param $user |
||
246 | * |
||
247 | * @return array |
||
248 | */ |
||
249 | private function guessPropertyOrMethodName($user) |
||
258 | |||
259 | /** |
||
260 | * Converts a string to camel case |
||
261 | * |
||
262 | * @param string $name |
||
263 | * |
||
264 | * @return string |
||
265 | */ |
||
266 | private function toCamelCase($name) |
||
274 | } |
||
275 |
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..