Edit   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 3
1
<?php
2
3
namespace App\Http\Controllers\Dna;
4
5
use App\Forms\Builders\DnaForm;
0 ignored issues
show
Bug introduced by
The type App\Forms\Builders\DnaForm was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use App\Models\Dna;
7
use Illuminate\Routing\Controller;
8
9
class Edit extends Controller
10
{
11
    public function __invoke(Dna $dna, DnaForm $form)
12
    {
13
        $role = \Auth::user()->role_id;
0 ignored issues
show
Bug introduced by
Accessing role_id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
14
        $user_id = \Auth::user()->id;
0 ignored issues
show
Bug introduced by
Accessing id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
15
        if (in_array($role, [1, 2]) || $user_id === $dna->user_id) {
16
            return ['form' => $form->edit($dna)];
17
        }
18
    }
19
}
20