Conditions | 1 |
Paths | 1 |
Total Lines | 156 |
Code Lines | 153 |
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 declare(strict_types=1); |
||
115 | public function privBuildMimeArray() |
||
116 | { |
||
117 | return [ |
||
118 | 'ez' => 'application/andrew-inset', |
||
119 | 'hqx' => 'application/mac-binhex40', |
||
120 | 'cpt' => 'application/mac-compactpro', |
||
121 | 'doc' => 'application/msword', |
||
122 | 'DOC' => 'application/msword', |
||
123 | 'Doc' => 'application/msword', |
||
124 | 'xls' => 'application/vnd.ms-excel', |
||
125 | 'Xls' => 'application/vnd.ms-excel', |
||
126 | 'XLS' => 'application/vnd.ms-excel', |
||
127 | 'bin' => 'application/octet-stream', |
||
128 | 'dms' => 'application/octet-stream', |
||
129 | 'lha' => 'application/octet-stream', |
||
130 | 'lzh' => 'application/octet-stream', |
||
131 | 'exe' => 'application/octet-stream', |
||
132 | 'class' => 'application/octet-stream', |
||
133 | 'so' => 'application/octet-stream', |
||
134 | 'dll' => 'application/octet-stream', |
||
135 | 'oda' => 'application/oda', |
||
136 | 'pdf' => 'application/pdf', |
||
137 | 'PDF' => 'application/pdf', |
||
138 | 'Pdf' => 'application/pdf', |
||
139 | 'ai' => 'application/postscript', |
||
140 | 'eps' => 'application/postscript', |
||
141 | 'ps' => 'application/postscript', |
||
142 | 'smi' => 'application/smil', |
||
143 | 'smil' => 'application/smil', |
||
144 | 'wbxml' => 'application/vnd.wap.wbxml', |
||
145 | 'wmlc' => 'application/vnd.wap.wmlc', |
||
146 | 'wmlsc' => 'application/vnd.wap.wmlscriptc', |
||
147 | 'bcpio' => 'application/x-bcpio', |
||
148 | 'vcd' => 'application/x-cdlink', |
||
149 | 'pgn' => 'application/x-chess-pgn', |
||
150 | 'cpio' => 'application/x-cpio', |
||
151 | 'csh' => 'application/x-csh', |
||
152 | 'dcr' => 'application/x-director', |
||
153 | 'dir' => 'application/x-director', |
||
154 | 'dxr' => 'application/x-director', |
||
155 | 'dvi' => 'application/x-dvi', |
||
156 | 'spl' => 'application/x-futuresplash', |
||
157 | 'gtar' => 'application/x-gtar', |
||
158 | 'hdf' => 'application/x-hdf', |
||
159 | 'js' => 'application/x-javascript', |
||
160 | 'skp' => 'application/x-koan', |
||
161 | 'skd' => 'application/x-koan', |
||
162 | 'skt' => 'application/x-koan', |
||
163 | 'skm' => 'application/x-koan', |
||
164 | 'latex' => 'application/x-latex', |
||
165 | 'nc' => 'application/x-netcdf', |
||
166 | 'cdf' => 'application/x-netcdf', |
||
167 | 'sh' => 'application/x-sh', |
||
168 | 'shar' => 'application/x-shar', |
||
169 | 'swf' => 'application/x-shockwave-flash', |
||
170 | 'sit' => 'application/x-stuffit', |
||
171 | 'sv4cpio' => 'application/x-sv4cpio', |
||
172 | 'sv4crc' => 'application/x-sv4crc', |
||
173 | 'tar' => 'application/x-tar', |
||
174 | 'tcl' => 'application/x-tcl', |
||
175 | 'tex' => 'application/x-tex', |
||
176 | 'texinfo' => 'application/x-texinfo', |
||
177 | 'texi' => 'application/x-texinfo', |
||
178 | 't' => 'application/x-troff', |
||
179 | 'tr' => 'application/x-troff', |
||
180 | 'roff' => 'application/x-troff', |
||
181 | 'man' => 'application/x-troff-man', |
||
182 | 'me' => 'application/x-troff-me', |
||
183 | 'ms' => 'application/x-troff-ms', |
||
184 | 'ustar' => 'application/x-ustar', |
||
185 | 'src' => 'application/x-wais-source', |
||
186 | 'xhtml' => 'application/xhtml+xml', |
||
187 | 'xht' => 'application/xhtml+xml', |
||
188 | 'zip' => 'application/x-zip-compressed', |
||
189 | 'Zip' => 'application/x-zip-compressed', |
||
190 | 'ZIP' => 'application/x-zip-compressed', |
||
191 | 'au' => 'audio/basic', |
||
192 | 'XM' => 'audio/fasttracker', |
||
193 | 'snd' => 'audio/basic', |
||
194 | 'mid' => 'audio/midi', |
||
195 | 'midi' => 'audio/midi', |
||
196 | 'kar' => 'audio/midi', |
||
197 | 'mpga' => 'audio/mpeg', |
||
198 | 'mp2' => 'audio/mpeg', |
||
199 | 'mp3' => 'audio/mpeg', |
||
200 | 'aif' => 'audio/x-aiff', |
||
201 | 'aiff' => 'audio/x-aiff', |
||
202 | 'aifc' => 'audio/x-aiff', |
||
203 | 'm3u' => 'audio/x-mpegurl', |
||
204 | 'ram' => 'audio/x-pn-realaudio', |
||
205 | 'rm' => 'audio/x-pn-realaudio', |
||
206 | 'rpm' => 'audio/x-pn-realaudio-plugin', |
||
207 | 'ra' => 'audio/x-realaudio', |
||
208 | 'wav' => 'audio/x-wav', |
||
209 | 'wax' => 'audio/x-windows-media', |
||
210 | 'pdb' => 'chemical/x-pdb', |
||
211 | 'xyz' => 'chemical/x-xyz', |
||
212 | 'bmp' => 'image/bmp', |
||
213 | 'gif' => 'image/gif', |
||
214 | 'ief' => 'image/ief', |
||
215 | // 'jpeg' => 'image/pjpeg', |
||
216 | 'jpeg' => 'image/jpeg', |
||
217 | 'jpg' => 'image/jpeg', |
||
218 | 'jpe' => 'image/jpeg', |
||
219 | 'png' => 'image/x-png', |
||
220 | 'tiff' => 'image/tiff', |
||
221 | 'tif' => 'image/tif', |
||
222 | 'ico' => 'image/icon', |
||
223 | 'djvu' => 'image/vnd.djvu', |
||
224 | 'djv' => 'image/vnd.djvu', |
||
225 | 'wbmp' => 'image/vnd.wap.wbmp', |
||
226 | 'ras' => 'image/x-cmu-raster', |
||
227 | 'pnm' => 'image/x-portable-anymap', |
||
228 | 'pbm' => 'image/x-portable-bitmap', |
||
229 | 'pgm' => 'image/x-portable-graymap', |
||
230 | 'ppm' => 'image/x-portable-pixmap', |
||
231 | 'rgb' => 'image/x-rgb', |
||
232 | 'xbm' => 'image/x-xbitmap', |
||
233 | 'xpm' => 'image/x-xpixmap', |
||
234 | 'xwd' => 'image/x-windowdump', |
||
235 | 'igs' => 'model/iges', |
||
236 | 'iges' => 'model/iges', |
||
237 | 'msh' => 'model/mesh', |
||
238 | 'mesh' => 'model/mesh', |
||
239 | 'silo' => 'model/mesh', |
||
240 | 'wrl' => 'model/vrml', |
||
241 | 'vrml' => 'model/vrml', |
||
242 | 'css' => 'text/css', |
||
243 | 'html' => 'text/html', |
||
244 | 'htm' => 'text/html', |
||
245 | 'asc' => 'text/plain', |
||
246 | 'txt' => 'text/plain', |
||
247 | 'Log' => 'text/plain', |
||
248 | 'log' => 'text/plain', |
||
249 | 'rtx' => 'text/richtext', |
||
250 | 'rtf' => 'text/rtf', |
||
251 | 'sgml' => 'text/sgml', |
||
252 | 'sgm' => 'text/sgml', |
||
253 | 'tsv' => 'text/tab-seperated-values', |
||
254 | 'wml' => 'text/vnd.wap.wml', |
||
255 | 'wmls' => 'text/vnd.wap.wmlscript', |
||
256 | 'etx' => 'text/x-setext', |
||
257 | 'xml' => 'text/xml', |
||
258 | 'xsl' => 'text/xml', |
||
259 | 'mpeg' => 'video/mpeg', |
||
260 | 'mpg' => 'video/mpeg', |
||
261 | 'mpe' => 'video/mpeg', |
||
262 | 'qt' => 'video/quicktime', |
||
263 | 'mov' => 'video/quicktime', |
||
264 | 'mxu' => 'video/vnd.mpegurl', |
||
265 | 'avi' => 'video/x-msvideo', |
||
266 | 'movie' => 'video/x-sgi-movie', |
||
267 | 'php' => 'text/php', |
||
268 | 'php3' => 'text/php3', |
||
269 | 'ice' => 'x-conference-xcooltalk', |
||
270 | 'unknown' => 'application/octet-stream', |
||
271 | ]; |
||
274 |