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

Update::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
rs 10
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