Passed
Pull Request — master (#1306)
by Curtis
06:06
created

Update   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
1
<?php
2
3
namespace App\Http\Controllers\enso\core\Administration\UserGroup;
4
5
use Illuminate\Routing\Controller;
6
use LaravelEnso\Core\Http\Requests\ValidateUserGroupRequest;
7
use LaravelEnso\Core\Models\UserGroup;
8
9
class Update extends Controller
10
{
11
    public function __invoke(ValidateUserGroupRequest $request, UserGroup $userGroup)
12
    {
13
        $userGroup->updateWithRoles(
14
            $request->validatedExcept('roles'),
15
            $request->get('roles')
0 ignored issues
show
Bug introduced by
It seems like $request->get('roles') can also be of type null; however, parameter $roles of LaravelEnso\Core\Models\...roup::updateWithRoles() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

15
            /** @scrutinizer ignore-type */ $request->get('roles')
Loading history...
16
        );
17
18
        return ['message' => __('The user group was successfully updated')];
19
    }
20
}
21