@@ -45,7 +45,7 @@ |
||
45 | 45 | return false; |
46 | 46 | } |
47 | 47 | |
48 | - return count($remainingPositions) === 0; |
|
48 | + return count($remainingPositions) === 0; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function percentage($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance): int |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | - if(count($requiredPositions) === 0) { |
|
62 | + if (count($requiredPositions) === 0) { |
|
63 | 63 | return 100; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $filled = count($requiredPositions) - count($remainingPositions); |
67 | 67 | |
68 | - $percentage = (int) round(($filled/count($requiredPositions)) * 100, 0); |
|
68 | + $percentage = (int) round(($filled / count($requiredPositions)) * 100, 0); |
|
69 | 69 | |
70 | - if($percentage > 100) { |
|
70 | + if ($percentage > 100) { |
|
71 | 71 | return 100; |
72 | 72 | } |
73 | 73 | return $percentage; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | private function getGroup(ActivityInstance $activityInstance) |
154 | 154 | { |
155 | - if($activityInstance->resource_type === 'group') { |
|
155 | + if ($activityInstance->resource_type === 'group') { |
|
156 | 156 | return $activityInstance->participant(); |
157 | 157 | } |
158 | 158 | return $activityInstance->participant()->group(); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | private function rolesThroughGroup(Group $group, ModuleInstance $moduleInstance) |
167 | 167 | { |
168 | 168 | $roles = $group->roles(); |
169 | - if($this->logicGroupId($moduleInstance) !== null) { |
|
169 | + if ($this->logicGroupId($moduleInstance) !== null) { |
|
170 | 170 | $logicGroup = app(LogicRepository::class)->getById($this->logicGroupId($moduleInstance)); |
171 | 171 | return $roles->filter(function(\BristolSU\ControlDB\Contracts\Models\Role $role) use ($moduleInstance, $logicGroup) { |
172 | 172 | return LogicTester::evaluate($logicGroup, null, $role->group(), $role); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | private function logicGroupId(ModuleInstance $moduleInstance) |
179 | 179 | { |
180 | 180 | $id = $moduleInstance->setting('logic_group', null); |
181 | - if($id === null) { |
|
181 | + if ($id === null) { |
|
182 | 182 | return null; |
183 | 183 | } |
184 | 184 | return (int) $id; |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | |
35 | 35 | public function getSettings(Group $group, array $settings) |
36 | 36 | { |
37 | - if(Cache::has($this->getCacheKey($group))) { |
|
37 | + if (Cache::has($this->getCacheKey($group))) { |
|
38 | 38 | return Cache::get($this->getCacheKey($group)); |
39 | 39 | } |
40 | - foreach ((array_key_exists('required', $settings)?$settings['required']:[]) as $setting) { |
|
40 | + foreach ((array_key_exists('required', $settings) ? $settings['required'] : []) as $setting) { |
|
41 | 41 | if ($this->groupIsForSetting($group, $setting)) { |
42 | 42 | Cache::put($this->getCacheKey($group), $setting['required'], 7200); |
43 | 43 | return $setting['required']; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function getCacheKey(Group $group) |
50 | 50 | { |
51 | - return RequiredSettingRetrieval::class . '.' . $group->id(); |
|
51 | + return RequiredSettingRetrieval::class.'.'.$group->id(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | protected function groupIsForSetting(Group $group, array $setting): bool |