Team   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 35.7%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 31
ccs 5
cts 14
cp 0.357
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 2
1
<?php
2
3
namespace App;
4
5
class Team extends \Xoco70\LaravelTournaments\Models\Team
6
{
7 9
    protected static function boot()
8
    {
9 9
        parent::boot();
10 9
        static::deleting(function ($team) {
11
            $teams = Team::where('championship_id', $team->championship_id)
12
                ->where('id', '>', $team->id)->get();
13
            foreach ($teams as $team) {
0 ignored issues
show
introduced by
$team is overwriting one of the parameters of this function.
Loading history...
14
                $team->short_id--;
0 ignored issues
show
Bug introduced by
The property short_id does not seem to exist on App\Team. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
15
                $team->save();
16
            }
17 9
        });
18 9
    }
19
20
    /**
21
     * Get all Invitations that belongs to a team
22
     * @return \Illuminate\Database\Eloquent\Relations\MorphMany
23
     */
24
    public function invites()
25
    {
26
        return $this->morphMany(Invite::class, 'object');
27
    }
28
29
    /**
30
     * Get all Invitations that belongs to a team
31
     * @return \Illuminate\Database\Eloquent\Relations\MorphMany
32
     */
33
    public function requests()
34
    {
35
        return $this->morphMany(Request::class, 'object');
36
    }
37
}