Test Failed
Push — master ( 414239...447ec5 )
by Julien
03:43
created

Category::getNameAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Xoco70\KendoTournaments\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * @property mixed team
9
 * @property mixed gender
10
 * @property mixed ageCategory
11
 * @property mixed ageMin
12
 * @property mixed ageMax
13
 * @property mixed gradeMin
14
 * @property mixed gradeMax
15
 * @property mixed isTeam
16
 */
17
class Category extends Model
18
{
19
    protected $table = 'category';
20
    public $timestamps = true;
21
22
    protected $fillable = [
23
        'id',
24
        'name',
25
        'gender',
26
        'isTeam',
27
        'ageCategory',
28
        'ageMin',
29
        'ageMax',
30
        'gradeCategory',
31
        'gradeMin',
32
        'gradeMax',
33
    ];
34
35
36
    public function getNameAttribute($name)
37
    {
38
39
        return trans($name);
40
    }
41
42
    public function getGradeAttribute($grade)
43
    {
44
        return trans($grade);
45
    }
46
47
    public function getAgeCategoryAttribute($ageCategory)
48
    {
49
        return trans($ageCategory);
50
    }
51
52
    public function tournaments()
53
    {
54
        return $this->belongsToMany('App\Tournament');
55
    }
56
57
//    public function settings()
0 ignored issues
show
Unused Code Comprehensibility introduced by
49% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
58
//    {
59
//        return $this->hasOne(ChampionshipSettings::class);
60
//    }
61
    public function championship()
62
    {
63
        return $this->hasMany(Championship::class);
64
    }
65
66
    public function isTeam()
67
    {
68
        return $this->isTeam;
69
    }
70
71
    public function isForMen()
72
    {
73
        return $this->gender == 'M';
74
    }
75
76
    public function isForWomen()
77
    {
78
        return $this->gender == 'F';
79
    }
80
81
    public function isMixt()
82
    {
83
        return $this->gender == 'X';
84
    }
85
}
86