11<?php
22
33declare (strict_types=1 );
4+
45/**
56 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
67 * SPDX-License-Identifier: AGPL-3.0-or-later
1617
1718class Config {
1819 public function __construct (
19- private IConfig $ config ,
20- private IAppConfig $ appConfig ,
21- private ISubAdmin $ subAdmin ,
22- private IUserSession $ userSession ,
23- private IGroupManager $ groupManager ,
20+ private readonly IConfig $ config ,
21+ private readonly IAppConfig $ appConfig ,
22+ private readonly ISubAdmin $ subAdmin ,
23+ private readonly IUserSession $ userSession ,
24+ private readonly IGroupManager $ groupManager ,
2425 ) {
2526 }
2627
2728 public function allowExternalStorage (): bool {
2829 return $ this ->appConfig ->getAppValueBool ('allow_external_storage ' , false );
2930 }
3031
31- /**
32- * @param string|bool $allow
33- */
34- public function setAllowExternalStorage ($ allow ): void {
32+ public function setAllowExternalStorage (string |bool $ allow ): void {
3533 $ this ->appConfig ->setAppValueBool ('allow_external_storage ' , $ allow === true || $ allow === 'true ' ) ;
3634 }
3735
3836 public function hideOtherUsers (): bool {
3937 return $ this ->appConfig ->getAppValueBool ('hide_users ' , true );
4038 }
4139
42- /**
43- * @param string|bool $hide
44- */
45- public function setHideOtherUsers ($ hide ): void {
40+ public function setHideOtherUsers (string |bool $ hide ): void {
4641 $ this ->appConfig ->setAppValueBool ('hide_users ' , $ hide === true || $ hide === 'true ' ) ;
4742 }
4843
@@ -54,25 +49,16 @@ public function useWhitelist(): bool {
5449 return $ this ->appConfig ->getAppValueBool ('usewhitelist ' , true );
5550 }
5651
57- /**
58- * @param string|bool $use
59- */
60- public function setUseWhitelist ($ use ): void {
52+ public function setUseWhitelist (string |bool $ use ): void {
6153 $ this ->appConfig ->setAppValueBool ('usewhitelist ' , $ use === true || $ use === 'true ' ) ;
6254 }
6355
64- /**
65- * @return string[]
66- */
6756 public function getAppWhitelist (): array {
6857 $ whitelist = $ this ->appConfig ->getAppValueString ('whitelist ' , AppWhitelist::DEFAULT_WHITELIST );
6958 return explode (', ' , $ whitelist );
7059 }
7160
72- /**
73- * @param array|string $whitelist
74- */
75- public function setAppWhitelist ($ whitelist ): void {
61+ public function setAppWhitelist (array |string $ whitelist ): void {
7662 if (is_array ($ whitelist )) {
7763 $ whitelist = implode (', ' , $ whitelist );
7864 }
@@ -106,13 +92,9 @@ public function canCreateGuests(): bool {
10692 }
10793 }
10894
109-
11095 return !$ this ->isSharingRestrictedToGroup ();
11196 }
11297
113- /**
114- * @return string[]
115- */
11698 public function getCreateRestrictedToGroup (): array {
11799 $ groups = $ this ->appConfig ->getAppValueArray ('create_restricted_to_group ' , []);
118100 // If empty, it means there is no restriction
@@ -126,9 +108,6 @@ public function getCreateRestrictedToGroup(): array {
126108 return array_values (array_unique ($ this ->appConfig ->getAppValueArray ('create_restricted_to_group ' , [])));
127109 }
128110
129- /**
130- * @param string[] $groups
131- */
132111 public function setCreateRestrictedToGroup (array $ groups ): void {
133112 $ this ->appConfig ->setAppValueArray ('create_restricted_to_group ' , $ groups );
134113 }
0 commit comments