Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 24 | class FormEngine { |
||
| 25 | /** |
||
| 26 | * Helper to display document's thumbnail for table "tx_dlf_documents" |
||
| 27 | * |
||
| 28 | * @access public |
||
| 29 | * |
||
| 30 | * @param array &$params: An array with parameters |
||
| 31 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 32 | * |
||
| 33 | * @return string HTML <img> tag for thumbnail |
||
| 34 | */ |
||
| 35 | public function displayThumbnail(&$params, &$pObj) { |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Helper to get flexform's items array for plugin "tx_dlf_collection" |
||
| 46 | * |
||
| 47 | * @access public |
||
| 48 | * |
||
| 49 | * @param array &$params: An array with parameters |
||
| 50 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 51 | * |
||
| 52 | * @return void |
||
| 53 | */ |
||
| 54 | View Code Duplication | public function itemsProcFunc_collectionList(&$params, &$pObj) { |
|
| 78 | |||
| 79 | /** |
||
| 80 | * Helper to get flexform's items array for plugin "Search" |
||
| 81 | * |
||
| 82 | * @access public |
||
| 83 | * |
||
| 84 | * @param array &$params: An array with parameters |
||
| 85 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 86 | * |
||
| 87 | * @return void |
||
| 88 | */ |
||
| 89 | View Code Duplication | public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { |
|
| 114 | |||
| 115 | /** |
||
| 116 | * Helper to get flexform's items array for plugin "Search" |
||
| 117 | * |
||
| 118 | * @access public |
||
| 119 | * |
||
| 120 | * @param array &$params: An array with parameters |
||
| 121 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 122 | * |
||
| 123 | * @return void |
||
| 124 | */ |
||
| 125 | View Code Duplication | public function itemsProcFunc_facetsList(&$params, &$pObj) { |
|
| 150 | |||
| 151 | /** |
||
| 152 | * Helper to get flexform's items array for plugin "OaiPmh" |
||
| 153 | * |
||
| 154 | * @access public |
||
| 155 | * |
||
| 156 | * @param array &$params: An array with parameters |
||
| 157 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 158 | * |
||
| 159 | * @return void |
||
| 160 | */ |
||
| 161 | View Code Duplication | public function itemsProcFunc_libraryList(&$params, &$pObj) { |
|
| 185 | |||
| 186 | /** |
||
| 187 | * Helper to get flexform's items array for plugin "Search" |
||
| 188 | * |
||
| 189 | * @access public |
||
| 190 | * |
||
| 191 | * @param array &$params: An array with parameters |
||
| 192 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 193 | * |
||
| 194 | * @return void |
||
| 195 | */ |
||
| 196 | View Code Duplication | public function itemsProcFunc_solrList(&$params, &$pObj) { |
|
| 219 | |||
| 220 | /** |
||
| 221 | * Helper to get flexform's items array for plugin "Toolbox" |
||
| 222 | * |
||
| 223 | * @access public |
||
| 224 | * |
||
| 225 | * @param array &$params: An array with parameters |
||
| 226 | * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object |
||
| 227 | * |
||
| 228 | * @return void |
||
| 229 | */ |
||
| 230 | public function itemsProcFunc_toolList(&$params, &$pObj) { |
||
| 235 | |||
| 236 | private function fixPageUid(&$pages) { |
||
| 242 | } |
||
| 243 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.