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