Completed
Push — master ( 988498...4210f3 )
by Manel
06:18
created

CreateEnrollmentsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 60.87 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 28
loc 46
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 28 28 1
A down() 0 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
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateEnrollmentsTable extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14 View Code Duplication
    public function up()
0 ignored issues
show
Duplication introduced by
This method 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...
15
    {
16
        Schema::create('enrollments', function (Blueprint $table) {
0 ignored issues
show
Bug introduced by
The method create() does not exist on Illuminate\Support\Facades\Schema. Did you maybe mean createFreshMockInstance()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
17
            $table->increments('id'); //obligatori
18
            $table->string('name'); //CAMP NO FORMA PART, només vull provar.
19
            $table->boolean('validated'); //només les vàlides són actives.
20
            $table->boolean('finished'); //indica si la matricula està finalitzada.
21
            //$table->integer('period_id'); //De moment descartat //obligatori
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
22
            $table->integer('classroom_id')->unsigned()->nullable(); //indica si la matricula està finalitzada.
23
            $table->integer('study_id')->unsigned()->nullable();
24
            $table->integer('course_id')->unsigned()->nullable();
25
            $table->timestamps(); //timestamps
26
27
28
29
//            $table->foreign('classroom_id')->references('id')->on('classrooms'); //indica si la matricula està finalitzada.
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
30
//            $table->foreign('study_id')->references('id')->on('studies');
31
//            $table->foreign('course_id')->references('id')->on('courses');
32
        });
33
34
//        Schema::create('enrollment_user', function (Blueprint $table) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
35
//            $table->integer('enrollment_id')->unsigned();
36
//            $table->integer('user_id')->unsigned();
37
//            $table->timestamps();
38
//            $table->unique(['enrollment_id', 'user_id']);
39
//        });
40
41
    }
42
43
    /**
44
     * Reverse the migrations.
45
     *
46
     * @return void
47
     */
48
    public function down()
49
    {
50
        Schema::dropIfExists('enrollments');
51
    }
52
}
53