2222class NavigationCspLoader implements CspLoader
2323{
2424 /**
25- * Loads CSP directives for user navigation items that have an external URL
25+ * Load CSP directives for user navigation items that have an external URL
2626 *
2727 * @param string $type The navigation type
2828 * @param array $typeConfig The navigation type configuration
29- * @param User $user user to check access for.
29+ * @param User $user User to check access for
3030 *
3131 * @return AttributedCsp[]
3232 */
33- protected function loadUserConfig (
34- string $ type ,
35- array $ typeConfig ,
36- User $ user ,
37- ): array {
33+ protected function loadUserConfig (string $ type , array $ typeConfig , User $ user ): array
34+ {
3835 $ config = Config::navigation ($ type , $ user ->getUsername ());
3936 if ($ config ->isEmpty ()) {
4037 return [];
@@ -59,11 +56,12 @@ protected function loadUserConfig(
5956 }
6057
6158 /**
62- * Loads CSP directives for shared navigation items that have an external URL
59+ * Load CSP directives for shared navigation items that have an external URL
6360 *
64- * @param string $type the navigation type
65- * @param array $typeConfig the navigation type configuration
66- * @param ?User $user user to check access for. If null, all shared navigation items are loaded.
61+ * @param string $type The navigation type
62+ * @param array $typeConfig The navigation type configuration
63+ * @param ?User $user User to check access for. If null, all shared
64+ * navigation items are loaded.
6765 *
6866 * @return array
6967 */
@@ -97,14 +95,14 @@ protected function loadSharedConfig(string $type, array $typeConfig, ?User $user
9795 }
9896
9997 /**
100- * Parses a navigation section and returns an AttributedCsp if the section is valid and should be loaded
98+ * Parse a navigation section and return an AttributedCsp if the section is valid and should be loaded
10199 *
102- * @param string $type 1st level navigation type
103- * @param array $typeConfig 1st level navigation type configuration
104- * @param string $sectionName the name of the ini section
105- * @param ConfigObject $section the navigation section
106- * @param bool $isShared whether the section is shared
107- * @param ?string $username the username of the user, if the section is bound to a user
100+ * @param string $type First level navigation type
101+ * @param array $typeConfig First level navigation type configuration
102+ * @param string $sectionName The name of the ini section
103+ * @param ConfigObject $section The navigation section
104+ * @param bool $isShared Whether the section is shared
105+ * @param ?string $username The username of the user, if the section is bound to a user
108106 *
109107 * @return ?AttributedCsp
110108 */
@@ -176,23 +174,15 @@ public function loadForUser(User $user): array
176174 $ result = [];
177175 $ navigationTypes = Navigation::getItemTypeConfiguration ();
178176 foreach ($ navigationTypes as $ type => $ typeConfig ) {
179- $ result = array_merge ($ result , $ this ->loadSharedConfig (
180- $ type ,
181- $ typeConfig ,
182- $ user ,
183- ));
184- $ result = array_merge ($ result , $ this ->loadUserConfig (
185- $ type ,
186- $ typeConfig ,
187- $ user ,
188- ));
177+ $ result = array_merge ($ result , $ this ->loadSharedConfig ($ type , $ typeConfig , $ user ));
178+ $ result = array_merge ($ result , $ this ->loadUserConfig ($ type , $ typeConfig , $ user ));
189179 }
190180
191181 return $ result ;
192182 }
193183
194184 /**
195- * Checks whether the user has access to a shared navigation item
185+ * Check whether the user has access to a shared navigation item
196186 *
197187 * Also handles inheritance of access restrictions. This method mimics the
198188 * behavior of {@see \Icinga\Application\Web::hasAccessToSharedNavigationItem()}.
@@ -212,11 +202,7 @@ private function hasAccessToSharedNavigationItem(ConfigObject $config, Config $n
212202 if (isset ($ config ['parent ' ]) && $ navConfig ->hasSection ($ config ['parent ' ])) {
213203 $ parentConfig = $ navConfig ->getSection ($ config ['parent ' ]);
214204
215- return $ this ->hasAccessToSharedNavigationItem (
216- $ parentConfig ,
217- $ navConfig ,
218- $ user ,
219- );
205+ return $ this ->hasAccessToSharedNavigationItem ($ parentConfig , $ navConfig , $ user );
220206 }
221207
222208 if (isset ($ config ['users ' ])) {
0 commit comments