GamesCoupdecoeur   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 24
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A game() 4 4 1
A user() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Models;
9
10
use Illuminate\Database\Eloquent\Model;
11
12
/**
13
 * Class GamesCoupdecoeur.
14
 *
15
 * @property int $id
16
 * @property int $game_id
17
 * @property int $user_id
18
 * @property \Carbon\Carbon $created_at
19
 * @property \Carbon\Carbon $updated_at
20
 * @method static \Illuminate\Database\Query\Builder|\App\Models\GamesCoupdecoeur whereId($value)
21
 * @method static \Illuminate\Database\Query\Builder|\App\Models\GamesCoupdecoeur whereGameId($value)
22
 * @method static \Illuminate\Database\Query\Builder|\App\Models\GamesCoupdecoeur whereUserId($value)
23
 * @method static \Illuminate\Database\Query\Builder|\App\Models\GamesCoupdecoeur whereCreatedAt($value)
24
 * @method static \Illuminate\Database\Query\Builder|\App\Models\GamesCoupdecoeur whereUpdatedAt($value)
25
 * @mixin \Eloquent
26
 * @property-read \App\Models\Game $game
27
 * @property-read \App\Models\User $user
28
 * @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory
29
 */
30 View Code Duplication
class GamesCoupdecoeur extends Model
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
{
32
    use \Venturecraft\Revisionable\RevisionableTrait;
33
    protected $table = 'games_coupdecoeur';
34
35
    public $timestamps = true;
36
37
    protected $fillable = [
38
        'game_id',
39
        'user_id',
40
    ];
41
42
    protected $guarded = [];
43
44
    public function game()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
45
    {
46
        return $this->hasOne('App\Models\Game', 'id', 'game_id')->with('maker', 'developers', 'gamefiles');
47
    }
48
49
    public function user()
50
    {
51
        return $this->hasOne('App\Models\User', 'id', 'user_id');
52
    }
53
}
54