ChampionshipRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 34
ccs 4
cts 12
cp 0.3333
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 3 1
A rules() 0 3 1
A getInvite() 0 10 2
1
<?php
2
3
namespace App\Http\Requests;
4
5
use App\Invite;
6
use App\Tournament;
7
use Illuminate\Support\Facades\Auth;
8
9
class ChampionshipRequest extends Request
10
{
11
12
    /**
13
     * Determine if the user is authorized to make this request.
14
     *
15
     * @return bool
16
     */
17 1
    public function authorize()
18
    {
19 1
        return true;
20
    }
21
22
    /**
23
     * Get the validation rules that apply to the request.
24
     *
25
     * @return array
26
     */
27 1
    public function rules()
28
    {
29
        return [
30 1
        ];
31
    }
32
33
    public function getInvite(Tournament $tournament)
34
    {
35
        if ($this->invite != 0)
36
            return Invite::findOrFail($this->invite);
37
38
        return Invite::where('code', 'open')
39
            ->where('email', Auth::user()->email)
40
            ->where('object_type', 'App\Tournament')
41
            ->where('object_id', $tournament->id)
42
            ->get();
43
    }
44
}
45