Completed
Pull Request — master (#23)
by Armando
10:28
created

UpdateSchema0530To0540   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 11 11 2
A down() 11 11 2

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
declare(strict_types=1);
4
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Support\Facades\Schema;
7
use PhpTelegramBot\Laravel\Migration;
8
9 View Code Duplication
class UpdateSchema0530To0540 extends Migration
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...
10
{
11
    public function up(): void
12
    {
13
        try {
14
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
15
                $table->text('game')->nullable()->comment('Message is a game, information about the game.')->after('document');
16
            });
17
        } catch (Throwable $e) {
18
            \Log::error($e->getMessage ());
19
            return; // Migration may be partly done already...
20
        }
21
    }
22
23
    public function down(): void
24
    {
25
        try {
26
            Schema::table($this->prefix . 'message', static function (Blueprint $table) {
27
                $table->dropColumn('game');
28
            });
29
        } catch (Throwable $e) {
30
            \Log::error($e->getMessage ());
31
            return; // Migration may be partly done already...
32
        }
33
    }
34
}
35