Conditions | 1 |
Paths | 1 |
Total Lines | 262 |
Code Lines | 211 |
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 |
||
7 | public function up(): void |
||
8 | { |
||
9 | $table = $this->table('developers'); |
||
10 | $table |
||
11 | ->addColumn('github_id', 'integer', [ |
||
12 | 'default' => null, |
||
13 | 'limit' => 10, |
||
14 | 'null' => true, |
||
15 | ]) |
||
16 | ->addColumn('full_name', 'string', [ |
||
17 | 'default' => null, |
||
18 | 'limit' => 50, |
||
19 | 'null' => true, |
||
20 | ]) |
||
21 | ->addColumn('email', 'string', [ |
||
22 | 'default' => null, |
||
23 | 'limit' => 70, |
||
24 | 'null' => true, |
||
25 | ]) |
||
26 | ->addColumn('gravatar_id', 'string', [ |
||
27 | 'default' => null, |
||
28 | 'limit' => 100, |
||
29 | 'null' => true, |
||
30 | ]) |
||
31 | ->addColumn('access_token', 'string', [ |
||
32 | 'default' => null, |
||
33 | 'limit' => 100, |
||
34 | 'null' => true, |
||
35 | ]) |
||
36 | ->addColumn('created', 'datetime', [ |
||
37 | 'default' => null, |
||
38 | 'limit' => null, |
||
39 | 'null' => true, |
||
40 | ]) |
||
41 | ->addColumn('modified', 'datetime', [ |
||
42 | 'default' => null, |
||
43 | 'limit' => null, |
||
44 | 'null' => true, |
||
45 | ]) |
||
46 | ->addColumn('has_commit_access', 'boolean', [ |
||
47 | 'default' => 0, |
||
48 | 'limit' => null, |
||
49 | 'null' => false, |
||
50 | ]) |
||
51 | ->addIndex( |
||
52 | ['github_id'], |
||
53 | ['unique' => true] |
||
54 | ) |
||
55 | ->create(); |
||
56 | $table = $this->table('incidents'); |
||
57 | $table |
||
58 | ->addColumn('error_name', 'string', [ |
||
59 | 'default' => null, |
||
60 | 'limit' => 30, |
||
61 | 'null' => true, |
||
62 | ]) |
||
63 | ->addColumn('error_message', 'string', [ |
||
64 | 'default' => null, |
||
65 | 'limit' => 100, |
||
66 | 'null' => true, |
||
67 | ]) |
||
68 | ->addColumn('pma_version', 'string', [ |
||
69 | 'default' => null, |
||
70 | 'limit' => 30, |
||
71 | 'null' => true, |
||
72 | ]) |
||
73 | ->addColumn('php_version', 'string', [ |
||
74 | 'default' => null, |
||
75 | 'limit' => 15, |
||
76 | 'null' => true, |
||
77 | ]) |
||
78 | ->addColumn('browser', 'string', [ |
||
79 | 'default' => null, |
||
80 | 'limit' => 40, |
||
81 | 'null' => true, |
||
82 | ]) |
||
83 | ->addColumn('user_os', 'string', [ |
||
84 | 'default' => null, |
||
85 | 'limit' => 30, |
||
86 | 'null' => true, |
||
87 | ]) |
||
88 | ->addColumn('server_software', 'string', [ |
||
89 | 'default' => null, |
||
90 | 'limit' => 100, |
||
91 | 'null' => true, |
||
92 | ]) |
||
93 | ->addColumn('stackhash', 'string', [ |
||
94 | 'default' => null, |
||
95 | 'limit' => 32, |
||
96 | 'null' => false, |
||
97 | ]) |
||
98 | ->addColumn('configuration_storage', 'string', [ |
||
99 | 'default' => null, |
||
100 | 'limit' => 30, |
||
101 | 'null' => true, |
||
102 | ]) |
||
103 | ->addColumn('script_name', 'string', [ |
||
104 | 'default' => null, |
||
105 | 'limit' => 255, |
||
106 | 'null' => true, |
||
107 | ]) |
||
108 | ->addColumn('steps', 'text', [ |
||
109 | 'default' => null, |
||
110 | 'limit' => null, |
||
111 | 'null' => true, |
||
112 | ]) |
||
113 | ->addColumn('stacktrace', 'text', [ |
||
114 | 'default' => null, |
||
115 | 'limit' => null, |
||
116 | 'null' => true, |
||
117 | ]) |
||
118 | ->addColumn('full_report', 'text', [ |
||
119 | 'default' => null, |
||
120 | 'limit' => null, |
||
121 | 'null' => true, |
||
122 | ]) |
||
123 | ->addColumn('report_id', 'integer', [ |
||
124 | 'default' => null, |
||
125 | 'limit' => 10, |
||
126 | 'null' => false, |
||
127 | ]) |
||
128 | ->addColumn('created', 'datetime', [ |
||
129 | 'default' => null, |
||
130 | 'limit' => null, |
||
131 | 'null' => true, |
||
132 | ]) |
||
133 | ->addColumn('modified', 'datetime', [ |
||
134 | 'default' => null, |
||
135 | 'limit' => null, |
||
136 | 'null' => true, |
||
137 | ]) |
||
138 | ->addColumn('exception_type', 'boolean', [ |
||
139 | 'default' => null, |
||
140 | 'limit' => null, |
||
141 | 'null' => true, |
||
142 | ]) |
||
143 | ->addIndex( |
||
144 | ['created'] |
||
145 | ) |
||
146 | ->create(); |
||
147 | $table = $this->table('notifications'); |
||
148 | $table |
||
149 | ->addColumn('developer_id', 'integer', [ |
||
150 | 'default' => null, |
||
151 | 'limit' => 10, |
||
152 | 'null' => false, |
||
153 | ]) |
||
154 | ->addColumn('report_id', 'integer', [ |
||
155 | 'default' => null, |
||
156 | 'limit' => 10, |
||
157 | 'null' => false, |
||
158 | ]) |
||
159 | ->addColumn('created', 'datetime', [ |
||
160 | 'default' => null, |
||
161 | 'limit' => null, |
||
162 | 'null' => true, |
||
163 | ]) |
||
164 | ->addColumn('modified', 'datetime', [ |
||
165 | 'default' => null, |
||
166 | 'limit' => null, |
||
167 | 'null' => true, |
||
168 | ]) |
||
169 | ->create(); |
||
170 | $table = $this->table('products'); |
||
171 | $table |
||
172 | ->addColumn('name', 'string', [ |
||
173 | 'default' => null, |
||
174 | 'limit' => 255, |
||
175 | 'null' => false, |
||
176 | ]) |
||
177 | ->addColumn('description', 'text', [ |
||
178 | 'default' => null, |
||
179 | 'limit' => null, |
||
180 | 'null' => false, |
||
181 | ]) |
||
182 | ->addColumn('created', 'datetime', [ |
||
183 | 'default' => null, |
||
184 | 'limit' => null, |
||
185 | 'null' => false, |
||
186 | ]) |
||
187 | ->addColumn('modified', 'datetime', [ |
||
188 | 'default' => null, |
||
189 | 'limit' => null, |
||
190 | 'null' => false, |
||
191 | ]) |
||
192 | ->create(); |
||
193 | $table = $this->table('reports'); |
||
194 | $table |
||
195 | ->addColumn('error_message', 'string', [ |
||
196 | 'default' => null, |
||
197 | 'limit' => 150, |
||
198 | 'null' => true, |
||
199 | ]) |
||
200 | ->addColumn('error_name', 'string', [ |
||
201 | 'default' => null, |
||
202 | 'limit' => 50, |
||
203 | 'null' => true, |
||
204 | ]) |
||
205 | ->addColumn('pma_version', 'string', [ |
||
206 | 'default' => null, |
||
207 | 'limit' => 50, |
||
208 | 'null' => true, |
||
209 | ]) |
||
210 | ->addColumn('status', 'string', [ |
||
211 | 'default' => null, |
||
212 | 'limit' => 20, |
||
213 | 'null' => true, |
||
214 | ]) |
||
215 | ->addColumn('location', 'text', [ |
||
216 | 'default' => null, |
||
217 | 'limit' => null, |
||
218 | 'null' => false, |
||
219 | ]) |
||
220 | ->addColumn('linenumber', 'integer', [ |
||
221 | 'default' => null, |
||
222 | 'limit' => 11, |
||
223 | 'null' => false, |
||
224 | ]) |
||
225 | ->addColumn('sourceforge_bug_id', 'integer', [ |
||
226 | 'default' => null, |
||
227 | 'limit' => 10, |
||
228 | 'null' => true, |
||
229 | ]) |
||
230 | ->addColumn('related_to', 'integer', [ |
||
231 | 'default' => null, |
||
232 | 'limit' => 10, |
||
233 | 'null' => true, |
||
234 | ]) |
||
235 | ->addColumn('created', 'datetime', [ |
||
236 | 'default' => null, |
||
237 | 'limit' => null, |
||
238 | 'null' => true, |
||
239 | ]) |
||
240 | ->addColumn('modified', 'datetime', [ |
||
241 | 'default' => null, |
||
242 | 'limit' => null, |
||
243 | 'null' => true, |
||
244 | ]) |
||
245 | ->addColumn('exception_type', 'boolean', [ |
||
246 | 'default' => null, |
||
247 | 'limit' => null, |
||
248 | 'null' => true, |
||
249 | ]) |
||
250 | ->create(); |
||
251 | $table = $this->table('schema_migrations'); |
||
252 | $table |
||
253 | ->addColumn('class', 'string', [ |
||
254 | 'default' => null, |
||
255 | 'limit' => 255, |
||
256 | 'null' => false, |
||
257 | ]) |
||
258 | ->addColumn('type', 'string', [ |
||
259 | 'default' => null, |
||
260 | 'limit' => 50, |
||
261 | 'null' => false, |
||
262 | ]) |
||
263 | ->addColumn('created', 'datetime', [ |
||
264 | 'default' => null, |
||
265 | 'limit' => null, |
||
266 | 'null' => false, |
||
267 | ]) |
||
268 | ->create(); |
||
269 | } |
||
281 |