Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Branch blood-banks-feature (e99ec3)
by José
03:49
created

Campaign   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A owner() 4 4 1
A comments() 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 DoeSangue\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
use DoeSangue\Models\User;
8
use DoeSangue\Models\Comment;
9
use DoeSangue\Uuids;
10
11 View Code Duplication
class Campaign extends Model
12
{
13
14
    use SoftDeletes, Uuids;
15
16
    /**
17
     * The table associated with the model.
18
     *
19
     * @var string
20
     */
21
    protected $table = 'campaigns';
22
23
    /**
24
     * Indicates if the IDs are auto-incrementing.
25
     *
26
     * @var bool
27
     */
28
    public $incrementing = false;
29
30
    /**
31
     * The attributes that are mass assignable.
32
     *
33
     * @var array
34
     */
35
    protected $filliable = [ 'title', 'description', 'image', 'expires', 'user_id' ];
36
37
    protected $hidden = [ 'created_at', 'updated_at', 'deleted_at', 'user_id' ];
38
39
    protected $dates = [
40
      'created_at', 'updated_at', 'deleted_at'
41
    ];
42
43
    /**
44
     * Return the owner of campaign
45
     */
46
    public function owner()
47
    {
48
        return $this->belongsTo(User::class, 'user_id');
49
    }
50
51
    public function comments()
52
    {
53
        return $this->hasMany(Comment::class);
54
    }
55
56
}
57