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

Test Setup Failed
Pull Request — development (#68)
by José
06:06
created

CreateCampaignsTable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 50
loc 50
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A up() 19 19 1
A down() 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 GiveBlood\Modules\Campaign\Database\Migrations;
4
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Database\Migrations\Migration;
7
8 View Code Duplication
class CreateCampaignsTable extends Migration
9
{
10
    /**
11
     * @var \Illuminate\Database\Schema\Builder
12
     */
13
    protected $schema;
14
15
    /**
16
     * Migration constructor.
17
     */
18
    public function __construct()
19
    {
20
        $this->schema = app('db')->connection()->getSchemaBuilder();
21
    }
22
23
    /**
24
     * Run the migrations.
25
     *
26
     * @return void
27
     */
28
    public function up()
29
    {
30
        $this->schema->create(
31
            'campaigns', function (Blueprint $table) {
32
                $table->uuid('id')->unique()->primary();
33
                $table->string('title');
34
                $table->text('description');
35
                $table->string('image')->nullable();
36
                $table->dateTimeTz('expires');
37
                $table->uuid('user_id');
38
                $table->string('slug');
39
                $table->timestamps();
40
                $table->softDeletes();
41
42
                // $table->foreign('user_id')->references('id')->on('users')
43
                //       ->onDelete('cascade');
44
            }
45
        );
46
    }
47
48
    /**
49
     * Reverse the migrations.
50
     *
51
     * @return void
52
     */
53
    public function down()
54
    {
55
        $this->schema->drop('campaigns');
56
    }
57
}
58