| Conditions | 4 |
| Paths | 8 |
| Total Lines | 58 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | if (!Schema::hasTable('med_forms')) { |
||
| 17 | Schema::create('med_forms', function (Blueprint $table) { |
||
| 18 | $table->id(); |
||
| 19 | $table->uuid('uniq_id'); |
||
| 20 | $table->text('intro')->nullable(); |
||
| 21 | $table->boolean('in_database')->default(0); |
||
| 22 | $table->boolean('by_mail')->default(0); |
||
| 23 | $table->boolean('display_captcha')->default(0); |
||
| 24 | $table->string('mail_to', 255)->nullable(); |
||
| 25 | $table->boolean('include_data')->default(0); |
||
| 26 | $table->string('subject_admin', 255)->nullable(); |
||
| 27 | $table->text('message_admin')->nullable(); |
||
| 28 | $table->boolean('copy_user')->default(0); |
||
| 29 | $table->string('field_mail_name')->nullable(); |
||
| 30 | $table->string('subject_user', 255)->nullable(); |
||
| 31 | $table->text('message_user')->nullable(); |
||
| 32 | $table->boolean('display_title')->default(1); |
||
| 33 | $table->boolean('display_intro')->default(1); |
||
| 34 | $table->boolean('display_header')->default(1); |
||
| 35 | $table->boolean('display_footer')->default(1); |
||
| 36 | $table->boolean('multiple_steps')->default(0); |
||
| 37 | $table->json('formio_component')->nullable(); |
||
| 38 | $table->json('validation_rules')->nullable(); |
||
| 39 | $table->unsignedBigInteger('created_by')->nullable(); |
||
| 40 | $table->unsignedBigInteger('updated_by')->nullable(); |
||
| 41 | $table->timestamps(); |
||
| 42 | }); |
||
| 43 | } |
||
| 44 | |||
| 45 | if (!Schema::hasTable('med_form_translations')) { |
||
| 46 | Schema::create('med_form_translations', function (Blueprint $table) { |
||
| 47 | $table->id(); |
||
| 48 | $table->string('title', 255)->nullable(); |
||
| 49 | $table->string('text_button'); |
||
| 50 | $table->string('slug')->nullable(); |
||
| 51 | $table->string('locale')->nullable(); |
||
| 52 | $table->text('description')->nullable(); |
||
| 53 | $table->text('header')->nullable(); |
||
| 54 | $table->text('footer')->nullable(); |
||
| 55 | $table->timestamps(); |
||
| 56 | $table->unsignedBigInteger('form_id')->nullable(); |
||
| 57 | $table->foreign('form_id') |
||
| 58 | ->references('id') |
||
| 59 | ->on('med_forms') |
||
| 60 | ->onDelete('cascade'); |
||
| 61 | }); |
||
| 62 | } |
||
| 63 | |||
| 64 | if (!Schema::hasTable('med_entries')) { |
||
| 65 | Schema::create('med_entries', function (Blueprint $table) { |
||
| 66 | $table->id(); |
||
| 67 | $table->text('structure_form')->nullable(); |
||
| 68 | $table->text('structure_result')->nullable(); |
||
| 69 | $table->unsignedBigInteger('fb_form_id'); |
||
| 70 | $table->timestamps(); |
||
| 71 | $table->foreign('fb_form_id')->references('id')->on('med_forms'); |
||
| 72 | }); |
||
| 90 |