Progress::index()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 13
rs 9.9666
cc 2
nc 2
nop 1
1
<?php
2
3
namespace App\Http\Controllers\Gedcom;
4
5
use App\Http\Controllers\Controller;
6
use App\ImportJob;
7
use Auth;
8
use Illuminate\Http\Request;
9
10
class Progress extends Controller
11
{
12
    //
13
    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

13
    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...
14
    {
15
        $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...
16
        $runningjob = ImportJob::orderby('id', 'DESC')->first();
17
        $slug = null;
18
        if ($runningjob != null) {
19
            $slug = $runningjob->slug;
20
        }
21
        $ret = [];
22
        $ret['slug'] = $slug;
23
        $ret['user'] = $user_id;
24
25
        return $ret;
26
    }
27
}
28