RegisterController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace TaskManager\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use TaskManager\Http\Requests\RegisterForm;
7
use TaskManager\Mail\WelcomeNewUser;
8
9
class RegisterController extends Controller
10
{
11
    public function __construct()
12
    {
13
        $this->middleware('guest');
14
    }
15
16
    /**
17
     * Show the form for creating a new resource.
18
     *
19
     * @return \Illuminate\Http\Response
20
     */
21
    public function create()
22
    {
23
        return view('register');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('register') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
24
    }
25
26
    /**
27
     * Store a newly created resource in storage.
28
     *
29
     * @param  \Illuminate\Http\Request $request
30
     * @param RegisterForm $form
31
     * @return \Illuminate\Http\Response
32
     */
33
    public function store(Request $request, RegisterForm $form)
0 ignored issues
show
Unused Code introduced by
The parameter $form 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

33
    public function store(Request $request, /** @scrutinizer ignore-unused */ RegisterForm $form)

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...
34
    {
35
       $user = \TaskManager\User::create($request->only('email','name','password'));
36
       auth()->login($user);
0 ignored issues
show
Bug introduced by
The method login() does not exist on Illuminate\Contracts\Auth\Factory. ( Ignorable by Annotation )

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

36
       auth()->/** @scrutinizer ignore-call */ login($user);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
       \Mail::to($user)->send(new WelcomeNewUser($user));
38
       return redirect()->home();
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect()->home() returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
39
    }
40
41
}
42