| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0987 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 10 | public function passes($attribute, $value) |
|
| 39 | { |
||
| 40 | try { |
||
| 41 | 10 | $settings = $this->positionSettingRetrieval->getSettings($this->group()); |
|
| 42 | } catch (\Exception $e) { |
||
| 43 | return false; |
||
| 44 | } |
||
| 45 | 10 | if(in_array($value, $settings['only_one_role'])) { |
|
| 46 | 3 | $roles = $this->roleRepository->allThroughGroup($this->group()); |
|
| 47 | |||
| 48 | return $roles->filter(function(\BristolSU\ControlDB\Contracts\Models\Role $role) use ($value) { |
||
| 49 | 1 | return $role->positionId() === (int) $value; |
|
| 50 | 3 | })->count() === 0; |
|
| 51 | } |
||
| 52 | 7 | return true; |
|
| 53 | } |
||
| 67 | } |