Complex classes like FileFormFactory often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use FileFormFactory, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 17 | class FileFormFactory extends AssetFormFactory  | 
            ||
| 18 | { | 
            ||
| 19 | protected function getFormFieldTabs($record, $context = [])  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * Build "Usage" tab  | 
            ||
| 39 | *  | 
            ||
| 40 | * @param File $record  | 
            ||
| 41 | * @param array $context  | 
            ||
| 42 | * @return Tab  | 
            ||
| 43 | */  | 
            ||
| 44 | protected function getFormFieldUsageTab($record, $context = [])  | 
            ||
| 55 | |||
| 56 | protected function getFormFieldDetailsTab($record, $context = [])  | 
            ||
| 80 | |||
| 81 | /**  | 
            ||
| 82 | * Create tab for file attributes  | 
            ||
| 83 | *  | 
            ||
| 84 | * @param File $record  | 
            ||
| 85 | * @param array $context  | 
            ||
| 86 | * @return Tab  | 
            ||
| 87 | */  | 
            ||
| 88 | protected function getFormFieldAttributesTab($record, $context = [])  | 
            ||
| 102 | |||
| 103 | protected function getFormFields(Controller $controller, $name, $context = [])  | 
            ||
| 117 | |||
| 118 | /**  | 
            ||
| 119 | * Get publish action  | 
            ||
| 120 | *  | 
            ||
| 121 | * @param File $record  | 
            ||
| 122 | * @return FormAction  | 
            ||
| 123 | */  | 
            ||
| 124 | protected function getPublishAction($record)  | 
            ||
| 136 | |||
| 137 | protected function getFormActions(Controller $controller, $name, $context = [])  | 
            ||
| 158 | |||
| 159 | /**  | 
            ||
| 160 | * Get raw HTML for image markup  | 
            ||
| 161 | *  | 
            ||
| 162 | * @param File $file  | 
            ||
| 163 | * @return string  | 
            ||
| 164 | */  | 
            ||
| 165 | protected function getIconMarkup($file)  | 
            ||
| 187 | |||
| 188 | /**  | 
            ||
| 189 | * get HTML for status icon  | 
            ||
| 190 | *  | 
            ||
| 191 | * @param File $record  | 
            ||
| 192 | * @return null|string  | 
            ||
| 193 | */  | 
            ||
| 194 | protected function getSpecsMarkup($record)  | 
            ||
| 205 | |||
| 206 | /**  | 
            ||
| 207 | * Get published status flag  | 
            ||
| 208 | *  | 
            ||
| 209 | * @param File $record  | 
            ||
| 210 | * @return null|string  | 
            ||
| 211 | */  | 
            ||
| 212 | protected function getStatusFlagMarkup($record)  | 
            ||
| 219 | |||
| 220 | /**  | 
            ||
| 221 | * Get user-visible "Path" for this record  | 
            ||
| 222 | *  | 
            ||
| 223 | * @param File $record  | 
            ||
| 224 | * @return string  | 
            ||
| 225 | */  | 
            ||
| 226 | protected function getPath($record)  | 
            ||
| 237 | |||
| 238 | /**  | 
            ||
| 239 | * Get action for adding to campaign  | 
            ||
| 240 | *  | 
            ||
| 241 | * @param File $record  | 
            ||
| 242 | * @return FormAction|null  | 
            ||
| 243 | */  | 
            ||
| 244 | protected function getAddToCampaignAction($record)  | 
            ||
| 254 | |||
| 255 | /**  | 
            ||
| 256 | * Get action for publishing  | 
            ||
| 257 | *  | 
            ||
| 258 | * @param File $record  | 
            ||
| 259 | * @return FormAction  | 
            ||
| 260 | */  | 
            ||
| 261 | protected function getUnpublishAction($record)  | 
            ||
| 276 | |||
| 277 | /**  | 
            ||
| 278 | * Build popup menu  | 
            ||
| 279 | *  | 
            ||
| 280 | * @param File $record  | 
            ||
| 281 | * @return PopoverField  | 
            ||
| 282 | */  | 
            ||
| 283 | protected function getPopoverMenu($record)  | 
            ||
| 297 | |||
| 298 | /**  | 
            ||
| 299 | * @param File $record  | 
            ||
| 300 | * @return FormAction  | 
            ||
| 301 | */  | 
            ||
| 302 | protected function getInsertAction($record)  | 
            ||
| 310 | }  | 
            ||
| 311 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.