| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| 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 |
||
| 14 | public function changeSchema(Schema $schema, array $options) { |
||
| 15 | // Add a new table to track user file transfer request |
||
| 16 | $table = $options['tablePrefix'] . TransferRequestMapper::TABLENAME; |
||
| 17 | $table = $schema->createTable($table); |
||
| 18 | $table->addColumn( |
||
| 19 | 'id', |
||
| 20 | Type::INTEGER, |
||
| 21 | [ |
||
| 22 | 'comment' => 'Unique identifier for the transfer request', |
||
| 23 | 'autoincrement' => true |
||
| 24 | ]); |
||
| 25 | $table->addColumn( |
||
| 26 | 'source_user_id', |
||
| 27 | Type::STRING, |
||
| 28 | [ |
||
| 29 | 'comment' => 'The user who initiated the request' |
||
| 30 | ]); |
||
| 31 | $table->addColumn( |
||
| 32 | 'destination_user_id', |
||
| 33 | Type::STRING, |
||
| 34 | [ |
||
| 35 | 'comment' => 'The user who should receive the files' |
||
| 36 | ]); |
||
| 37 | $table->addColumn( |
||
| 38 | 'file_id', |
||
| 39 | Type::BIGINT, |
||
| 40 | [ |
||
| 41 | 'comment' => 'The file id for the folder to be transferred' |
||
| 42 | ]); |
||
| 43 | $table->addColumn( |
||
| 44 | 'requested_time', |
||
| 45 | Type::INTEGER, |
||
| 46 | [ |
||
| 47 | 'comment' => 'Time when the request was created by the source user' |
||
| 48 | ]); |
||
| 49 | $table->addColumn( |
||
| 50 | 'accepted_time', |
||
| 51 | Type::INTEGER, |
||
| 52 | [ |
||
| 53 | 'comment' => 'Time when the request was accepted by the destination user', |
||
| 54 | 'notnull' => false |
||
| 55 | ]); |
||
| 56 | $table->addColumn( |
||
| 57 | 'rejected_time', |
||
| 58 | Type::INTEGER, |
||
| 59 | [ |
||
| 60 | 'comment' => 'Time when the request was rejected by the destination user', |
||
| 61 | 'notnull' => false |
||
| 62 | ]); |
||
| 63 | $table->addColumn( |
||
| 64 | 'actioned_time', |
||
| 65 | Type::INTEGER, |
||
| 66 | [ |
||
| 67 | 'comment' => 'Time when the transfer actually completed on storage', |
||
| 68 | 'notnull' => false |
||
| 69 | ]); |
||
| 70 | $table->setPrimaryKey(['id']); |
||
| 71 | } |
||
| 72 | |||
| 74 |