GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Model   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 4
Metric Value
wmc 3
c 5
b 0
f 4
lcom 1
cbo 2
dl 50
loc 50
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 8 8 1
A make() 4 4 1
A guitars() 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
namespace App;
4
5
use Illuminate\Database\Eloquent;
6
7
/**
8
 * App\Model.
9
 *
10
 * @property int $id
11
 * @property int $make_id
12
 * @property string $name
13
 * @property string $photo
14
 * @property \Carbon\Carbon $deleted_at
15
 * @property-read \App\Make $make
16
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Guitar[] $guitars
17
 * @method static \Illuminate\Database\Query\Builder|\App\Model whereId($value)
18
 * @method static \Illuminate\Database\Query\Builder|\App\Model whereMakeId($value)
19
 * @method static \Illuminate\Database\Query\Builder|\App\Model whereName($value)
20
 * @method static \Illuminate\Database\Query\Builder|\App\Model wherePhoto($value)
21
 * @method static \Illuminate\Database\Query\Builder|\App\Model whereDeletedAt($value)
22
 * @mixin \Eloquent
23
 */
24 View Code Duplication
class Model extends Eloquent\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...
25
{
26
    use Eloquent\SoftDeletes;
27
28
    /**
29
     * We do not want any timestamps.
30
     *
31
     * @var bool
32
     */
33
    public $timestamps = false;
34
    /**
35
     * @var array
36
     */
37
    protected $dates = ['deleted_at'];
38
    /**
39
     * The attributes that are not mass assignable.
40
     *
41
     * @var array
42
     */
43
    protected $guarded = [];
44
45 5
    public static function boot()
46
    {
47 5
        parent::boot();
48
49 5
        static::deleting(function (Model $model) {
50 2
            $model->guitars()->delete();
51 5
        });
52 5
    }
53
54
    /**
55
     * Make of this model.
56
     *
57
     * @return Eloquent\Relations\BelongsTo
58
     */
59 1
    public function make()
60
    {
61 1
        return $this->belongsTo(Make::class);
62
    }
63
64
    /**
65
     * Guitars of this model.
66
     *
67
     * @return Eloquent\Relations\HasMany
68
     */
69 2
    public function guitars()
70
    {
71 2
        return $this->hasMany(Guitar::class);
72
    }
73
}
74