| Conditions | 2 |
| Paths | 2 |
| Total Lines | 51 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 66 | public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
||
| 67 | /** @var ISchemaWrapper $schema */ |
||
| 68 | $schema = $schemaClosure(); |
||
| 69 | |||
| 70 | if (!$schema->hasTable('circle_remote')) { |
||
| 71 | $table = $schema->createTable('circle_remote'); |
||
| 72 | $table->addColumn( |
||
| 73 | 'id', 'integer', [ |
||
| 74 | 'autoincrement' => true, |
||
| 75 | 'notnull' => true, |
||
| 76 | 'length' => 4, |
||
| 77 | 'unsigned' => true, |
||
| 78 | ] |
||
| 79 | ); |
||
| 80 | $table->addColumn( |
||
| 81 | 'uid', 'string', [ |
||
| 82 | 'notnull' => false, |
||
| 83 | 'length' => 20, |
||
| 84 | ] |
||
| 85 | ); |
||
| 86 | $table->addColumn( |
||
| 87 | 'instance', 'string', [ |
||
| 88 | 'notnull' => false, |
||
| 89 | 'length' => 127, |
||
| 90 | ] |
||
| 91 | ); |
||
| 92 | $table->addColumn( |
||
| 93 | 'href', 'string', [ |
||
| 94 | 'notnull' => false, |
||
| 95 | 'length' => 254, |
||
| 96 | ] |
||
| 97 | ); |
||
| 98 | $table->addColumn( |
||
| 99 | 'item', 'text', [ |
||
| 100 | 'notnull' => false, |
||
| 101 | ] |
||
| 102 | ); |
||
| 103 | $table->addColumn( |
||
| 104 | 'creation', 'datetime', [ |
||
| 105 | 'notnull' => false, |
||
| 106 | ] |
||
| 107 | ); |
||
| 108 | |||
| 109 | $table->setPrimaryKey(['id']); |
||
| 110 | $table->addUniqueIndex(['instance']); |
||
| 111 | $table->addIndex(['uid']); |
||
| 112 | $table->addIndex(['href']); |
||
| 113 | } |
||
| 114 | |||
| 115 | return $schema; |
||
| 116 | } |
||
| 117 | |||
| 120 |