1 | <?php |
||
10 | class GroupOptions extends Model implements \JsonSerializable |
||
11 | { |
||
12 | const OPTION_SYNC = 'sync'; |
||
13 | const OPTION_ALLOW = 'allow'; |
||
14 | |||
15 | const NO_GROUP = 'nogroup'; |
||
16 | const ALLOW_ANY = 'allowany'; |
||
17 | |||
18 | /** |
||
19 | * @var int[] |
||
20 | */ |
||
21 | private $sync = []; |
||
22 | |||
23 | /** |
||
24 | * @var int[] |
||
25 | */ |
||
26 | private $allow = []; |
||
27 | |||
28 | /** |
||
29 | * @param array $groups |
||
30 | * @return GroupOptions |
||
31 | */ |
||
32 | public function setSync(array $groups) |
||
36 | |||
37 | /** |
||
38 | * @return int[] |
||
39 | */ |
||
40 | public function getSync() |
||
44 | |||
45 | /** |
||
46 | * @param $id |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function shouldSync($id): bool |
||
53 | |||
54 | /** |
||
55 | * @param array $groups |
||
56 | * @return GroupOptions |
||
57 | */ |
||
58 | public function setAllow(array $groups) |
||
62 | |||
63 | |||
64 | /** |
||
65 | * @return int[] |
||
66 | */ |
||
67 | public function getAllow() |
||
71 | |||
72 | /** |
||
73 | * @param $id |
||
74 | * @return bool |
||
75 | */ |
||
76 | public function shouldAllow($id): bool |
||
80 | |||
81 | /** |
||
82 | * @param User $user |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function shouldAllowNoGroupAssigned(User $user): bool |
||
89 | |||
90 | /** |
||
91 | * @return bool |
||
92 | */ |
||
93 | public function shouldAllowAny(): bool |
||
97 | |||
98 | /** |
||
99 | * @param array $options |
||
100 | * @return $this |
||
101 | */ |
||
102 | public function setOptions(array $options) |
||
115 | |||
116 | /** |
||
117 | * @param $option |
||
118 | * @param array $groups |
||
119 | * @return $this |
||
120 | */ |
||
121 | private function setOption($option, array $groups) |
||
136 | |||
137 | /** |
||
138 | * @return array |
||
139 | */ |
||
140 | public function jsonSerialize() |
||
147 | } |
||
148 |