EventPicture   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
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 27
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 4 4 1
A event() 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 EventPicture.
14
 *
15
 * @property int $id
16
 * @property int $user_id
17
 * @property int $event_id
18
 * @property string $title
19
 * @property string $desc
20
 * @property string $filename
21
 * @property \Carbon\Carbon $created_at
22
 * @property \Carbon\Carbon $updated_at
23
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereId($value)
24
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereUserId($value)
25
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereEventId($value)
26
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereTitle($value)
27
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereDesc($value)
28
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereFilename($value)
29
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereCreatedAt($value)
30
 * @method static \Illuminate\Database\Query\Builder|\App\Models\EventPicture whereUpdatedAt($value)
31
 * @mixin \Eloquent
32
 * @property-read \App\Models\User $user
33
 * @property-read \App\Models\Event $event
34
 * @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory
35
 */
36 View Code Duplication
class EventPicture 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...
37
{
38
    use \Venturecraft\Revisionable\RevisionableTrait;
39
    protected $table = 'event_pictures';
40
41
    public $timestamps = true;
42
43
    protected $fillable = [
44
        'user_id',
45
        'event_id',
46
        'title',
47
        'desc',
48
        'filename',
49
    ];
50
51
    protected $guarded = [];
52
53
    public function user()
54
    {
55
        return $this->hasOne('App\Models\User', 'id', 'user_id');
56
    }
57
58
    public function event()
59
    {
60
        return $this->hasOne('App\Models\Event', 'id', 'event_id');
61
    }
62
}
63