Complex classes like EditView 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 EditView, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 45 | class EditView { | 
            ||
| 46 | /**  | 
            ||
| 47 | * smarty object  | 
            ||
| 48 | * @var object  | 
            ||
| 49 | */  | 
            ||
| 50 | var $ss;  | 
            ||
| 51 | /**  | 
            ||
| 52 | * location of template to use  | 
            ||
| 53 | * @var string  | 
            ||
| 54 | */  | 
            ||
| 55 | var $template;  | 
            ||
| 56 | /**  | 
            ||
| 57 | * Module to use  | 
            ||
| 58 | * @var string  | 
            ||
| 59 | */  | 
            ||
| 60 | var $module;  | 
            ||
| 61 | |||
| 62 | /**  | 
            ||
| 63 | *  | 
            ||
| 64 | * @param string $module module to use  | 
            ||
| 65 | * @param string $template template of the form to retreive  | 
            ||
| 66 | */  | 
            ||
| 67 |     function __construct($module, $template) { | 
            ||
| 72 | |||
| 73 | /**  | 
            ||
| 74 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead  | 
            ||
| 75 | */  | 
            ||
| 76 |     function EditView($module, $template){ | 
            ||
| 86 | |||
| 87 | |||
| 88 | /**  | 
            ||
| 89 | * Processes / setups the template  | 
            ||
| 90 | * assigns all things to the template like mod_srings and app_strings  | 
            ||
| 91 | *  | 
            ||
| 92 | */  | 
            ||
| 93 |     function process() { | 
            ||
| 104 | |||
| 105 | |||
| 106 | /**  | 
            ||
| 107 | * Displays the template  | 
            ||
| 108 | *  | 
            ||
| 109 | * @return string HTML of parsed template  | 
            ||
| 110 | */  | 
            ||
| 111 |     function display() { | 
            ||
| 114 | |||
| 115 | }  | 
            ||
| 116 | ?>  |