@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | public function baseDirectory() |
100 | 100 | { |
101 | - return __DIR__ . '/..'; |
|
101 | + return __DIR__.'/..'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | public function boot() |
@@ -47,7 +47,7 @@ |
||
47 | 47 | } catch (\Exception $e) { |
48 | 48 | return false; |
49 | 49 | } |
50 | - if(in_array($value, $settings['only_one_user'])) { |
|
50 | + if (in_array($value, $settings['only_one_user'])) { |
|
51 | 51 | return $this->roleRepository->getById($value)->users()->count() === 0; |
52 | 52 | } |
53 | 53 | return true; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function authorize($ability, $arguments = []) |
18 | 18 | { |
19 | 19 | return $this->baseAuthorize( |
20 | - 'assign-roles.' . $ability, |
|
20 | + 'assign-roles.'.$ability, |
|
21 | 21 | $arguments |
22 | 22 | ); |
23 | 23 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public function rules() |
13 | 13 | { |
14 | 14 | return [ |
15 | - 'position_id' => ['required', app(PositionIsAllowed::class), app(PositionCanBeUsed::class)], |
|
15 | + 'position_id' => ['required', app(PositionIsAllowed::class), app(PositionCanBeUsed::class)], |
|
16 | 16 | 'role_name' => ['required', 'string', 'max:255', 'min:3'], |
17 | 17 | 'email' => ['nullable', 'sometimes', 'email'] |
18 | 18 | ]; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | private function logicGroupId() |
92 | 92 | { |
93 | 93 | $id = settings('logic_group', null); |
94 | - if($id === null) { |
|
94 | + if ($id === null) { |
|
95 | 95 | return null; |
96 | 96 | } |
97 | 97 | return (int) $id; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | private function filter(Collection $roles) |
113 | 113 | { |
114 | - if($this->hasLogicGroup()) { |
|
114 | + if ($this->hasLogicGroup()) { |
|
115 | 115 | return $roles->filter(function(\BristolSU\ControlDB\Contracts\Models\Role $role) { |
116 | 116 | return $this->isInLogicGroup($role); |
117 | 117 | })->values(); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | } catch (\Exception $e) { |
43 | 43 | return false; |
44 | 44 | } |
45 | - if(in_array($value, $settings['only_one_role'])) { |
|
45 | + if (in_array($value, $settings['only_one_role'])) { |
|
46 | 46 | $roles = $this->roleRepository->allThroughGroup($this->group()); |
47 | 47 | |
48 | 48 | return $roles->filter(function(\BristolSU\ControlDB\Contracts\Models\Role $role) use ($value) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | |
34 | - return count($remainingRoles) === 0; |
|
34 | + return count($remainingRoles) === 0; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function percentage($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance): int |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | public function percentage($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance): int |
38 | 38 | { |
39 | - if($activityInstance->resource_type === 'group') { |
|
39 | + if ($activityInstance->resource_type === 'group') { |
|
40 | 40 | $group = $activityInstance->participant(); |
41 | - } else if($activityInstance->resource_type === 'role') { |
|
41 | + } else if ($activityInstance->resource_type === 'role') { |
|
42 | 42 | $group = $activityInstance->participant()->group(); |
43 | 43 | } else { |
44 | 44 | return collect(); |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | |
54 | - if(count($requiredPositions) === 0) { |
|
54 | + if (count($requiredPositions) === 0) { |
|
55 | 55 | return 100; |
56 | 56 | } |
57 | 57 | |
58 | 58 | $filled = count($requiredPositions) - count($remainingPositions); |
59 | 59 | |
60 | - $percentage = (int) round(($filled/count($requiredPositions)) * 100, 0); |
|
60 | + $percentage = (int) round(($filled / count($requiredPositions)) * 100, 0); |
|
61 | 61 | |
62 | - if($percentage > 100) { |
|
62 | + if ($percentage > 100) { |
|
63 | 63 | return 100; |
64 | 64 | } |
65 | 65 | return $percentage; |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | protected function rolesNeededtoFill($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance) |
69 | 69 | { |
70 | - if($activityInstance->resource_type === 'group') { |
|
70 | + if ($activityInstance->resource_type === 'group') { |
|
71 | 71 | $group = $activityInstance->participant(); |
72 | - } else if($activityInstance->resource_type === 'role') { |
|
72 | + } else if ($activityInstance->resource_type === 'role') { |
|
73 | 73 | $group = $activityInstance->participant()->group(); |
74 | 74 | } else { |
75 | 75 | return collect(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $requiredPositions = $this->getRequiredPositions($settings, $group); |
79 | 79 | $roles = $group->roles(); |
80 | 80 | $logicGroupId = $moduleInstance->setting('logic_group', null); |
81 | - if($logicGroupId !== null) { |
|
81 | + if ($logicGroupId !== null) { |
|
82 | 82 | $logic = app(LogicRepository::class)->getById($logicGroupId); |
83 | 83 | |
84 | 84 | $roles = $roles->filter(function(\BristolSU\ControlDB\Contracts\Models\Role $role) use ($logic) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | private function logicGroupId() |
92 | 92 | { |
93 | 93 | $id = settings('logic_group', null); |
94 | - if($id === null) { |
|
94 | + if ($id === null) { |
|
95 | 95 | return null; |
96 | 96 | } |
97 | 97 | return (int) $id; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | private function filter(Collection $roles) |
113 | 113 | { |
114 | - if($this->hasLogicGroup()) { |
|
114 | + if ($this->hasLogicGroup()) { |
|
115 | 115 | return $roles->filter(function(\BristolSU\ControlDB\Contracts\Models\Role $role) { |
116 | 116 | return $this->isInLogicGroup($role); |
117 | 117 | })->values(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function getSettings(Group $group, array $settings) |
38 | 38 | { |
39 | - if(Cache::has($this->getCacheKey($group))) { |
|
39 | + if (Cache::has($this->getCacheKey($group))) { |
|
40 | 40 | return Cache::get($this->getCacheKey($group)); |
41 | 41 | } |
42 | 42 | foreach ($settings as $setting) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getCacheKey(Group $group) |
52 | 52 | { |
53 | - return RequiredSettingRetrieval::class . '.' . $group->id(); |
|
53 | + return RequiredSettingRetrieval::class.'.'.$group->id(); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | protected function groupIsForSetting(Group $group, array $setting): bool |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $logic = $this->logicRepository->getById($setting['logic_id']); |
65 | 65 | return app(LogicTester::class)->evaluate($logic, $user, $group, $role); |
66 | 66 | |
67 | - $groups = collect($this->logicAudience->groupAudience($logic))->map(function (Group $group) { |
|
67 | + $groups = collect($this->logicAudience->groupAudience($logic))->map(function(Group $group) { |
|
68 | 68 | return $group->id(); |
69 | 69 | }); |
70 | 70 | return $groups->contains($group->id()); |