Conditions | 1 |
Paths | 1 |
Total Lines | 55 |
Code Lines | 43 |
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 |
||
11 | public function createTable(SchemaSetupInterface $setup) |
||
12 | { |
||
13 | $table = $setup->getConnection()->newTable($setup->getTable('tkotosz_command_schedule')); |
||
14 | |||
15 | $table |
||
16 | ->addColumn( |
||
17 | CommandScheduleTable::COLUMN_SCHEDULE_ID, |
||
18 | Table::TYPE_INTEGER, |
||
19 | null, |
||
20 | ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true] |
||
21 | ) |
||
22 | ->addColumn( |
||
23 | CommandScheduleTable::COLUMN_COMMAND_NAME, |
||
24 | Table::TYPE_TEXT, 256, |
||
25 | ['nullable' => false], |
||
26 | 'Command Name' |
||
27 | ) |
||
28 | ->addColumn( |
||
29 | CommandScheduleTable::COLUMN_COMMAND_PARAMS, |
||
30 | Table::TYPE_TEXT, |
||
31 | null, |
||
32 | ['nullable' => false], |
||
33 | 'Command Params' |
||
34 | ) |
||
35 | ->addColumn( |
||
36 | CommandScheduleTable::COLUMN_STATUS, |
||
37 | Table::TYPE_TEXT, |
||
38 | 256, |
||
39 | ['nullable' => false], |
||
40 | 'Status' |
||
41 | ) |
||
42 | ->addColumn( |
||
43 | CommandScheduleTable::COLUMN_RESULT, |
||
44 | Table::TYPE_TEXT, |
||
45 | null, |
||
46 | ['nullable' => true], |
||
47 | 'Result' |
||
48 | ) |
||
49 | ->addColumn( |
||
50 | CommandScheduleTable::COLUMN_SCHEDULED_AT, |
||
51 | Table::TYPE_TIMESTAMP, |
||
52 | null, |
||
53 | ['nullable' => false, 'default' => Table::TIMESTAMP_INIT], |
||
54 | 'Scheduled At' |
||
55 | ) |
||
56 | ->addColumn( |
||
57 | CommandScheduleTable::COLUMN_UPDATED_AT, |
||
58 | Table::TYPE_TIMESTAMP, |
||
59 | null, |
||
60 | ['nullable' => false, 'default' => Table::TIMESTAMP_INIT_UPDATE], |
||
61 | 'Updated At' |
||
62 | ) |
||
63 | ; |
||
64 | |||
65 | $setup->getConnection()->createTable($table); |
||
66 | } |
||
68 |