| Conditions | 2 |
| Paths | 2 |
| Total Lines | 72 |
| Code Lines | 57 |
| 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 |
||
| 53 | public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
||
| 54 | /** @var ISchemaWrapper $schema */ |
||
| 55 | $schema = $schemaClosure(); |
||
| 56 | |||
| 57 | $table = $schema->getTable('jobs'); |
||
| 58 | $column = $table->getColumn('id'); |
||
| 59 | $column->setUnsigned(true); |
||
| 60 | |||
| 61 | $table = $schema->getTable('authtoken'); |
||
| 62 | $column = $table->getColumn('id'); |
||
| 63 | $column->setUnsigned(true); |
||
| 64 | $column = $table->getColumn('type'); |
||
| 65 | $column->setUnsigned(true); |
||
| 66 | if ($table->hasColumn('remember')) { |
||
| 67 | $column = $table->getColumn('remember'); |
||
| 68 | $column->setUnsigned(true); |
||
| 69 | } else { |
||
| 70 | $table->addColumn('remember', 'smallint', [ |
||
| 71 | 'notnull' => false, |
||
| 72 | 'length' => 1, |
||
| 73 | 'default' => 0, |
||
| 74 | 'unsigned' => true, |
||
| 75 | ]); |
||
| 76 | } |
||
| 77 | $column = $table->getColumn('last_activity'); |
||
| 78 | $column->setUnsigned(true); |
||
| 79 | $column = $table->getColumn('last_check'); |
||
| 80 | $column->setUnsigned(true); |
||
| 81 | |||
| 82 | $table = $schema->getTable('bruteforce_attempts'); |
||
| 83 | $column = $table->getColumn('id'); |
||
| 84 | $column->setUnsigned(true); |
||
| 85 | $column = $table->getColumn('occurred'); |
||
| 86 | $column->setUnsigned(true); |
||
| 87 | |||
| 88 | $table = $schema->getTable('comments'); |
||
| 89 | $column = $table->getColumn('id'); |
||
| 90 | $column->setUnsigned(true); |
||
| 91 | $column = $table->getColumn('parent_id'); |
||
| 92 | $column->setUnsigned(true); |
||
| 93 | $column = $table->getColumn('topmost_parent_id'); |
||
| 94 | $column->setUnsigned(true); |
||
| 95 | $column = $table->getColumn('children_count'); |
||
| 96 | $column->setUnsigned(true); |
||
| 97 | |||
| 98 | $table = $schema->getTable('file_locks'); |
||
| 99 | $column = $table->getColumn('id'); |
||
| 100 | $column->setUnsigned(true); |
||
| 101 | |||
| 102 | $table = $schema->getTable('systemtag'); |
||
| 103 | $column = $table->getColumn('id'); |
||
| 104 | $column->setUnsigned(true); |
||
| 105 | |||
| 106 | $table = $schema->getTable('systemtag_object_mapping'); |
||
| 107 | $column = $table->getColumn('systemtagid'); |
||
| 108 | $column->setUnsigned(true); |
||
| 109 | |||
| 110 | $table = $schema->getTable('systemtag_group'); |
||
| 111 | $column = $table->getColumn('systemtagid'); |
||
| 112 | $column->setUnsigned(true); |
||
| 113 | |||
| 114 | $table = $schema->getTable('vcategory'); |
||
| 115 | $column = $table->getColumn('id'); |
||
| 116 | $column->setUnsigned(true); |
||
| 117 | |||
| 118 | $table = $schema->getTable('vcategory_to_object'); |
||
| 119 | $column = $table->getColumn('objid'); |
||
| 120 | $column->setUnsigned(true); |
||
| 121 | $column = $table->getColumn('categoryid'); |
||
| 122 | $column->setUnsigned(true); |
||
| 123 | |||
| 124 | return $schema; |
||
| 125 | } |
||
| 136 |