| Conditions | 12 | 
| Paths | 96 | 
| Total Lines | 38 | 
| Code Lines | 21 | 
| Lines | 38 | 
| Ratio | 100 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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  | 
            ||
| 83 | View Code Duplication | protected function redirectTo($object)  | 
            |
| 84 |     { | 
            ||
| 85 | $request = $this->getRequest();  | 
            ||
| 86 | |||
| 87 | $url = $backToNodeList = false;  | 
            ||
| 88 |         $instanceAdmin = $this->admin->getConfigurationPool()->getInstance('alpixel_cms.admin.node'); | 
            ||
| 89 | |||
| 90 |         if (null !== $request->get('btn_update_and_list') || null !== $request->get('btn_create_and_list')) { | 
            ||
| 91 | $backToNodeList = true;  | 
            ||
| 92 | }  | 
            ||
| 93 | |||
| 94 |         if (null !== $request->get('btn_create_and_create')) { | 
            ||
| 95 | $params = array();  | 
            ||
| 96 |             if ($this->admin->hasActiveSubClass()) { | 
            ||
| 97 |                 $params['subclass'] = $request->get('subclass'); | 
            ||
| 98 | }  | 
            ||
| 99 |             $url = $this->admin->generateUrl('create', $params); | 
            ||
| 100 | }  | 
            ||
| 101 | |||
| 102 |         if ($this->getRestMethod() === 'DELETE') { | 
            ||
| 103 | $backToNodeList = true;  | 
            ||
| 104 | }  | 
            ||
| 105 | |||
| 106 |         if (!$url) { | 
            ||
| 107 |             foreach (array('edit', 'show') as $route) { | 
            ||
| 108 |                 if ($this->admin->hasRoute($route) && $this->admin->isGranted(strtoupper($route), $object)) { | 
            ||
| 109 | $url = $this->admin->generateObjectUrl($route, $object);  | 
            ||
| 110 | break;  | 
            ||
| 111 | }  | 
            ||
| 112 | }  | 
            ||
| 113 | }  | 
            ||
| 114 | |||
| 115 |         if ($backToNodeList || !$url) { | 
            ||
| 116 |             $url = $instanceAdmin->generateUrl('list'); | 
            ||
| 117 | }  | 
            ||
| 118 | |||
| 119 | return new RedirectResponse($url);  | 
            ||
| 120 | }  | 
            ||
| 121 | }  | 
            ||
| 122 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.