Completed
Push — develop ( 06396b...c3acb5 )
by Niclas Leon
12s
created

HomeController::index()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use Auth;
6
use App\Hacktoberfest\GitHub\PullRequestChecker;
7
8
class HomeController extends Controller
9
{
10
    /**
11
     * Instance of the 'pull request checker'.
12
     */
13
    protected $checker;
14
15
    /**
16
     * Create a new controller instance.
17
     *
18
     * @param PullRequestChecker $checker
19
     * @internal param PullRequestChecker $prChecker
20
     */
21
    public function __construct(PullRequestChecker $checker)
22
    {
23
        $this->checker = $checker;
24
    }
25
26
    /**
27
     * Display the current status if the user already signed in via GitHubs' OAuth API.
28
     * Display some infotext and the sign in button otherwise.
29
     *
30
     * @return Illuminate\View\View
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Illuminate\View\View was not found. Did you mean Illuminate\View\View? If so, make sure to prefix the type with \.
Loading history...
31
     */
32
    public function index()
33
    {
34
        if (Auth::check()) {
35
            $user = Auth::user();
36
37
            $prs = $this->checker->getQualifiedPullRequests($user);
38
39
            return view('status', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('status', ar... $user, 'prs' => $prs)) returns the type Illuminate\View\View which is incompatible with the documented return type App\Http\Controllers\Illuminate\View\View.
Loading history...
40
                'user' => $user,
41
                'prs' => $prs
42
            ]);
43
        }
44
45
        return view('index');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('index') returns the type Illuminate\View\View which is incompatible with the documented return type App\Http\Controllers\Illuminate\View\View.
Loading history...
46
    }
47
}
48