Progress   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 13 2
1
<?php
2
3
namespace App\Http\Controllers\Gedcom;
4
5
use App\Http\Controllers\Controller;
6
use App\Models\ImportJob;
7
use Auth;
8
use Illuminate\Http\Request;
9
10
class Progress extends Controller
11
{
12
    public function index(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

12
    public function index(/** @scrutinizer ignore-unused */ Request $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
    {
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
        $runningjob = ImportJob::orderby('id', 'DESC')->first();
16
        $slug = null;
17
        if ($runningjob !== null) {
18
            $slug = $runningjob->slug;
0 ignored issues
show
Bug introduced by
The property slug does not seem to exist on Illuminate\Database\Eloq...elations\HasManyThrough.
Loading history...
Bug introduced by
The property slug does not seem to exist on Illuminate\Database\Eloq...Relations\HasOneThrough.
Loading history...
19
        }
20
        $ret = [];
21
        $ret['slug'] = $slug;
22
        $ret['user'] = $user_id;
23
24
        return $ret;
25
    }
26
}
27