| Conditions | 10 | 
| Paths | 28 | 
| Total Lines | 35 | 
| Code Lines | 22 | 
| 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  | 
            ||
| 65 | public function upgrade(string $oldVersion): bool  | 
            ||
| 66 |     { | 
            ||
| 67 | // Upgrade dependent on old version number  | 
            ||
| 68 |         switch ($oldVersion) { | 
            ||
| 69 | case '1.3.1':  | 
            ||
| 70 |                 $this->setVar('smtpsecuremethod', 'ssl'); | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 71 | case '1.3.2':  | 
            ||
| 72 | // clear old modvars  | 
            ||
| 73 | // use manual method because getVars() is not available during system upgrade  | 
            ||
| 74 | $modVarEntities = $this->managerRegistry->getRepository(ExtensionVarEntity::class)->findBy(['modname' => $this->name]);  | 
            ||
| 75 | $modVars = [];  | 
            ||
| 76 |                 foreach ($modVarEntities as $var) { | 
            ||
| 77 | $modVars[$var['name']] = $var['value'];  | 
            ||
| 78 | }  | 
            ||
| 79 | $this->delVars();  | 
            ||
| 80 |                 $this->setVarWithDefault('charset', $modVars['charset']); | 
            ||
| 81 |                 $this->setVarWithDefault('encoding', $modVars['encoding']); | 
            ||
| 82 |                 $this->setVarWithDefault('html', $modVars['html']); | 
            ||
| 83 |                 $this->setVarWithDefault('wordwrap', $modVars['wordwrap']); | 
            ||
| 84 | // new modvar for 1.4.0  | 
            ||
| 85 |                 $this->setVarWithDefault('enableLogging', false); | 
            ||
| 86 | |||
| 87 | case '1.4.0':  | 
            ||
| 88 | case '1.4.1':  | 
            ||
| 89 | case '1.4.2':  | 
            ||
| 90 | case '1.4.3':  | 
            ||
| 91 | case '1.5.0':  | 
            ||
| 92 | case '1.5.1':  | 
            ||
| 93 | // all swiftmailer config changes removed from previous version upgrades above  | 
            ||
| 94 |                 $this->configDumper->delConfiguration('swiftmailer'); | 
            ||
| 95 | // future upgrade routines  | 
            ||
| 96 | }  | 
            ||
| 97 | |||
| 98 | // Update successful  | 
            ||
| 99 | return true;  | 
            ||
| 100 | }  | 
            ||
| 139 |