| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| Lines | 9 |
| Ratio | 13.04 % |
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 13 | public function up() |
||
| 14 | { |
||
| 15 | Schema::create('test_images', function (Blueprint $table) { |
||
| 16 | $table->increments('id'); |
||
| 17 | $table->string('image1'); |
||
| 18 | $table->string('image2'); |
||
| 19 | $table->string('image3'); |
||
| 20 | $table->string('image4'); |
||
| 21 | $table->string('image5'); |
||
| 22 | $table->string('image6'); |
||
| 23 | $table->timestamps(); |
||
| 24 | }); |
||
| 25 | |||
| 26 | Schema::create('test_multiple_images', function (Blueprint $table) { |
||
| 27 | $table->increments('id'); |
||
| 28 | $table->text('pictures'); |
||
| 29 | $table->timestamps(); |
||
| 30 | }); |
||
| 31 | |||
| 32 | Schema::create('test_files', function (Blueprint $table) { |
||
| 33 | $table->increments('id'); |
||
| 34 | $table->string('file1'); |
||
| 35 | $table->string('file2'); |
||
| 36 | $table->string('file3'); |
||
| 37 | $table->string('file4'); |
||
| 38 | $table->string('file5'); |
||
| 39 | $table->string('file6'); |
||
| 40 | $table->timestamps(); |
||
| 41 | }); |
||
| 42 | |||
| 43 | Schema::create('test_users', function (Blueprint $table) { |
||
| 44 | $table->increments('id'); |
||
| 45 | $table->string('username'); |
||
| 46 | $table->string('email'); |
||
| 47 | $table->string('mobile')->nullable(); |
||
| 48 | $table->string('avatar')->nullable(); |
||
| 49 | $table->string('password'); |
||
| 50 | $table->timestamps(); |
||
| 51 | }); |
||
| 52 | |||
| 53 | Schema::create('test_user_profiles', function (Blueprint $table) { |
||
| 54 | $table->increments('id'); |
||
| 55 | $table->string('user_id'); |
||
| 56 | $table->string('first_name')->nullable(); |
||
| 57 | $table->string('last_name')->nullable(); |
||
| 58 | $table->string('postcode')->nullable(); |
||
| 59 | $table->string('address')->nullable(); |
||
| 60 | $table->string('latitude')->nullable(); |
||
| 61 | $table->string('longitude')->nullable(); |
||
| 62 | $table->string('color')->nullable(); |
||
| 63 | $table->timestamp('start_at')->nullable(); |
||
| 64 | $table->timestamp('end_at')->nullable(); |
||
| 65 | |||
| 66 | $table->timestamps(); |
||
| 67 | }); |
||
| 68 | |||
| 69 | Schema::create('test_tags', function (Blueprint $table) { |
||
| 70 | $table->increments('id'); |
||
| 71 | $table->string('name'); |
||
| 72 | $table->timestamps(); |
||
| 73 | }); |
||
| 74 | |||
| 75 | Schema::create('test_user_tags', function (Blueprint $table) { |
||
| 76 | $table->integer('user_id'); |
||
| 77 | $table->integer('tag_id'); |
||
| 78 | $table->index(['user_id', 'tag_id']); |
||
| 79 | $table->timestamps(); |
||
| 80 | }); |
||
| 81 | } |
||
| 82 | |||
| 99 |