| Conditions | 10 | 
| Paths | 36 | 
| Total Lines | 23 | 
| Code Lines | 18 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 4 | ||
| Bugs | 1 | Features | 1 | 
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 | ||
| 95 | protected function getRedirect($currentRoute, $redirect = false) | ||
| 96 |     { | ||
| 97 | $useRedirect = $this->options->getUseRedirectParameterIfPresent(); | ||
| 98 | $routeExists = ($redirect && $this->routeExists($redirect)); | ||
| 99 |         if (!$useRedirect || !$routeExists) { | ||
| 100 | $redirect = false; | ||
| 101 | } | ||
| 102 | |||
| 103 |         switch ($currentRoute) { | ||
| 104 | case 'zfcuser/register': | ||
| 105 | case 'zfcuser/login': | ||
| 106 | case 'zfcuser/authenticate': | ||
| 107 | $route = ($redirect) ?: $this->options->getLoginRedirectRoute(); | ||
| 108 |                 return $this->router->assemble(array(), array('name' => $route)); | ||
| 109 | break; | ||
| 110 | case 'zfcuser/logout': | ||
| 111 | $route = ($redirect) ?: $this->options->getLogoutRedirectRoute(); | ||
| 112 |                 return $this->router->assemble(array(), array('name' => $route)); | ||
| 113 | break; | ||
| 114 | default: | ||
| 115 |                 return $this->router->assemble(array(), array('name' => 'zfcuser')); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | } | ||
| 119 |