Conditions | 1 |
Paths | 1 |
Total Lines | 64 |
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 |
||
47 | private function createPasswordMigratorTable(SchemaSetupInterface $setup): void |
||
48 | { |
||
49 | $table = $setup->getConnection()->newTable( |
||
50 | $setup->getTable(PasswordResource::TABLE_NAME) |
||
51 | )->addColumn( |
||
52 | Password::ID, |
||
53 | Table::TYPE_INTEGER, |
||
54 | null, |
||
55 | ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], |
||
56 | 'ID' |
||
57 | )->addColumn( |
||
58 | Password::CUSTOMER_ID, |
||
59 | Table::TYPE_INTEGER, |
||
60 | null, |
||
61 | ['unsigned' => true, 'nullable' => false], |
||
62 | 'Customer ID' |
||
63 | )->addColumn( |
||
64 | Password::PASSWORD, |
||
65 | Table::TYPE_TEXT, |
||
66 | null, |
||
67 | ['nullable' => false], |
||
68 | 'Password' |
||
69 | )->addColumn( |
||
70 | Password::SALT, |
||
71 | Table::TYPE_TEXT, |
||
72 | null, |
||
73 | ['nullable' => false], |
||
74 | 'Salt' |
||
75 | )->addColumn( |
||
76 | Password::CREATED_AT, |
||
77 | Table::TYPE_TIMESTAMP, |
||
78 | null, |
||
79 | ['nullable' => false, 'default' => Table::TIMESTAMP_INIT], |
||
80 | 'Create date' |
||
81 | )->addForeignKey( |
||
82 | $setup->getFkName( |
||
83 | PasswordResource::TABLE_NAME, |
||
84 | Password::CUSTOMER_ID, |
||
85 | $setup->getTable('customer_entity'), |
||
86 | 'entity_id' |
||
87 | ), |
||
88 | Password::CUSTOMER_ID, |
||
89 | $setup->getTable('customer_entity'), |
||
90 | 'entity_id', |
||
91 | Table::ACTION_CASCADE |
||
92 | )->addIndex( |
||
93 | $setup->getIdxName( |
||
94 | PasswordResource::TABLE_NAME, |
||
95 | [ |
||
96 | Password::CUSTOMER_ID |
||
97 | ], |
||
98 | AdapterInterface::INDEX_TYPE_UNIQUE |
||
99 | ), |
||
100 | [ |
||
101 | Password::CUSTOMER_ID |
||
102 | ], |
||
103 | [ |
||
104 | 'type' => AdapterInterface::INDEX_TYPE_UNIQUE |
||
105 | ] |
||
106 | )->setComment( |
||
107 | 'LizardMedia PasswordMigrator legacy passwords table' |
||
108 | ); |
||
109 | $setup->getConnection()->createTable($table); |
||
110 | } |
||
111 | } |
||
112 |