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
Branch master (114f68)
by Mark
08:50
created

CreateSettingsTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 70
Code Lines 53

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 53
nc 1
nop 0
dl 0
loc 70
rs 9.1724
c 1
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use App\Model\Setting;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateSettingsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        \Schema::create('settings', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->string('key');
19
            $table->string('value')->nullable();
20
            $table->string('default')->nullable();
21
            $table->timestamps();
22
        });
23
24
        $setting = new Setting;
25
        $setting->setKey('website_name');
26
        $setting->setShadow('Business Name CMS');
27
        $setting->save();
28
29
        $setting = new Setting;
30
        $setting->setKey('website_copyright');
31
        $setting->save();
32
33
        $setting = new Setting;
34
        $setting->setKey('seo_indexing');
35
        $setting->setShadow(false);
0 ignored issues
show
Bug introduced by
false of type false is incompatible with the type string expected by parameter $string of App\Model\Setting::setShadow(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
        $setting->setShadow(/** @scrutinizer ignore-type */ false);
Loading history...
36
        $setting->save();
37
38
        $setting = new Setting;
39
        $setting->setKey('seo_text');
40
        $setting->save();
41
42
        $setting = new Setting;
43
        $setting->setKey('seo_position');
44
        $setting->setShadow('left');
45
        $setting->save();
46
47
        $setting = new Setting;
48
        $setting->setKey('seo_separator');
49
        $setting->setShadow('|');
50
        $setting->save();
51
52
        $setting = new Setting;
53
        $setting->setKey('page_keywords');
54
        $setting->save();
55
56
        $setting = new Setting;
57
        $setting->setKey('page_description');
58
        $setting->save();
59
60
        $setting = new Setting;
61
        $setting->setKey('maintenance_mode');
62
        $setting->setShadow(true);
0 ignored issues
show
Bug introduced by
true of type true is incompatible with the type string expected by parameter $string of App\Model\Setting::setShadow(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

62
        $setting->setShadow(/** @scrutinizer ignore-type */ true);
Loading history...
63
        $setting->save();
64
65
        $setting = new Setting;
66
        $setting->setKey('address');
67
        $setting->save();
68
69
        $setting = new Setting;
70
        $setting->setKey('phone_number');
71
        $setting->save();
72
73
        $setting = new Setting;
74
        $setting->setKey('fax_number');
75
        $setting->save();
76
77
        $setting = new Setting;
78
        $setting->setKey('email_address');
79
        $setting->save();
80
81
        $setting = new Setting;
82
        $setting->setKey('facebook_id');
83
        $setting->save();
84
    }
85
86
    /**
87
     * Reverse the migrations.
88
     *
89
     * @return void
90
     */
91
    public function down()
92
    {
93
        \Schema::dropIfExists('settings');
94
    }
95
}
96