| Conditions | 1 |
| Paths | 1 |
| Total Lines | 97 |
| Code Lines | 92 |
| 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 |
||
| 20 | public function __construct(array $extraMimes = []) |
||
| 21 | { |
||
| 22 | $this->mimeTypes = array_merge( |
||
| 23 | [ |
||
| 24 | 'doc' => 'application/msword', |
||
| 25 | 'dot' => 'application/msword', |
||
| 26 | 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
||
| 27 | 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', |
||
| 28 | 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', |
||
| 29 | 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', |
||
| 30 | 'xls' => 'application/vnd.ms-excel', |
||
| 31 | 'xlt' => 'application/vnd.ms-excel', |
||
| 32 | 'xla' => 'application/vnd.ms-excel', |
||
| 33 | 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
||
| 34 | 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', |
||
| 35 | 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', |
||
| 36 | 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', |
||
| 37 | 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', |
||
| 38 | 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', |
||
| 39 | 'ppt' => 'application/vnd.ms-powerpoint', |
||
| 40 | 'pot' => 'application/vnd.ms-powerpoint', |
||
| 41 | 'pps' => 'application/vnd.ms-powerpoint', |
||
| 42 | 'ppa' => 'application/vnd.ms-powerpoint', |
||
| 43 | 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', |
||
| 44 | 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', |
||
| 45 | 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', |
||
| 46 | 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', |
||
| 47 | 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', |
||
| 48 | 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', |
||
| 49 | 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', |
||
| 50 | 'mdb' => 'application/vnd.ms-access', |
||
| 51 | 'aac' => 'audio/aac', |
||
| 52 | 'abw' => 'application/x-abiword', |
||
| 53 | 'arc' => 'application/octet-stream', |
||
| 54 | 'avi' => 'video/x-msvideo', |
||
| 55 | 'azw' => 'application/vnd.amazon.ebook', |
||
| 56 | 'bin' => 'application/octet-stream', |
||
| 57 | 'bz' => 'application/x-bzip', |
||
| 58 | 'bz2' => 'application/x-bzip2', |
||
| 59 | 'csh' => 'application/x-csh', |
||
| 60 | 'css' => 'text/css', |
||
| 61 | 'csv' => 'text/csv', |
||
| 62 | 'eot' => 'application/vnd.ms-fontobject', |
||
| 63 | 'epub' => 'application/epub+zip', |
||
| 64 | 'gif' => 'image/gif', |
||
| 65 | 'htm' => 'text/html', |
||
| 66 | 'html' => 'text/html', |
||
| 67 | 'twig' => 'text/html', |
||
| 68 | 'ico' => 'image/x-icon', |
||
| 69 | 'ics' => 'text/calendar', |
||
| 70 | 'jar' => 'application/java-archive', |
||
| 71 | 'jpeg' => 'image/jpeg', |
||
| 72 | 'jpg' => 'image/jpg', |
||
| 73 | 'js' => 'application/javascript', |
||
| 74 | 'json' => 'application/json', |
||
| 75 | 'mid' => 'audio/midi', |
||
| 76 | 'midi' => 'audio/midi', |
||
| 77 | 'mpeg' => 'video/mpeg', |
||
| 78 | 'mpkg' => 'application/vnd.apple.installer+xml', |
||
| 79 | 'odp' => 'application/vnd.oasis.opendocument.presentation', |
||
| 80 | 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', |
||
| 81 | 'odt' => 'application/vnd.oasis.opendocument.text', |
||
| 82 | 'oga' => 'audio/ogg', |
||
| 83 | 'ogv' => 'video/ogg', |
||
| 84 | 'ogx' => 'application/ogg', |
||
| 85 | 'otf' => 'font/otf', |
||
| 86 | 'png' => 'image/png', |
||
| 87 | 'pdf' => 'application/pdf', |
||
| 88 | 'rar' => 'application/x-rar-compressed', |
||
| 89 | 'rtf' => 'application/rtf', |
||
| 90 | 'sh' => 'application/x-sh', |
||
| 91 | 'svg' => 'image/svg+xml', |
||
| 92 | 'swf' => 'application/x-shockwave-flash', |
||
| 93 | 'tar' => 'application/x-tar', |
||
| 94 | 'tif' => 'image/tiff', |
||
| 95 | 'tiff' => 'image/tiff', |
||
| 96 | 'ts' => 'application/typescript', |
||
| 97 | 'txt' => 'text/plain', |
||
| 98 | 'ttf' => 'font/ttf', |
||
| 99 | 'vsd' => 'application/vnd.visio', |
||
| 100 | 'wav' => 'audio/x-wav', |
||
| 101 | 'weba' => 'audio/webm', |
||
| 102 | 'webm' => 'video/webm', |
||
| 103 | 'webp' => 'image/webp', |
||
| 104 | 'woff' => 'font/woff', |
||
| 105 | 'woff2' => 'font/woff2', |
||
| 106 | 'xhtml' => 'application/xhtml+xml', |
||
| 107 | 'xml' => 'application/xml', |
||
| 108 | 'xul' => 'application/vnd.mozilla.xul+xml', |
||
| 109 | 'zip' => 'application/zip', |
||
| 110 | '3gp' => 'video/3gpp', |
||
| 111 | '3g2' => 'video/3gpp2', |
||
| 112 | '7z' => 'application/x-7z-compressed' |
||
| 113 | ], |
||
| 114 | $extraMimes |
||
| 115 | ); |
||
| 116 | } |
||
| 117 | |||
| 162 | } |