| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| 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 |
||
| 117 | public function buildConfigMenu(array $options) |
||
| 118 | { |
||
| 119 | $menu = $this->factory->createItem('root'); |
||
| 120 | $menu->setChildrenAttribute('class', 'nav navbar-nav'); |
||
| 121 | |||
| 122 | $menu->addChild('config', array('label' => 'menu.configuration')) |
||
| 123 | ->setExtra('translation_domain', 'messages') |
||
| 124 | ->setAttribute('dropdown', true) |
||
| 125 | ->setAttribute('icon', 'fa fa-cog'); |
||
| 126 | |||
| 127 | $menu['config']->addChild('company', ['route' => 'company', 'label' => 'gestock.settings.company.title']) |
||
| 128 | ->setExtra('translation_domain', 'messages') |
||
| 129 | ->setAttribute('icon', 'glyphicon glyphicon-tower'); |
||
| 130 | |||
| 131 | $menu['config'] |
||
| 132 | ->addChild('applcation', ['route' => 'application', 'label' => 'gestock.settings.settings.title']) |
||
| 133 | ->setExtra('translation_domain', 'messages') |
||
| 134 | ->setAttribute('icon', 'glyphicon glyphicon-wrench') |
||
| 135 | ->setAttribute('divider_append', true); |
||
| 136 | |||
| 137 | $menu['config']->addChild('suppliers', ['label' => 'title', 'route' => 'supplier']) |
||
| 138 | ->setExtra('translation_domain', 'gs_suppliers') |
||
| 139 | ->setAttribute('icon', 'fa fa-barcode'); |
||
| 140 | |||
| 141 | $menu['config']->addChild('article', ['label' => 'title', 'route' => 'article']) |
||
| 142 | ->setExtra('translation_domain', 'gs_articles') |
||
| 143 | ->setAttribute('icon', 'fa fa-shopping-basket'); |
||
| 144 | |||
| 145 | $divers = $menu['config']->addChild('divers', ['label' => 'gestock.settings.diverse.title']) |
||
| 146 | ->setExtra('translation_domain', 'messages') |
||
| 147 | ->setAttribute('dropdown', true) |
||
| 148 | ->setAttribute('class', 'dropdown-submenu') |
||
| 149 | ->setAttribute('icon', 'glyphicon glyphicon-info-sign'); |
||
| 150 | |||
| 151 | $divers->addChild('familylog', ['route' => 'familylog', 'label' => 'gestock.settings.diverse.familylog']) |
||
| 152 | ->setAttribute('icon', 'glyphicon glyphicon-tag'); |
||
| 153 | |||
| 154 | $divers |
||
| 155 | ->addChild('zonestorage', ['route' => 'zonestorage', 'label' => 'gestock.settings.diverse.zonestorage']) |
||
| 156 | ->setAttribute('icon', 'glyphicon glyphicon-map-marker'); |
||
| 157 | |||
| 158 | $divers |
||
| 159 | ->addChild('unit', ['route' => 'unit', 'label' => 'gestock.settings.diverse.unit']) |
||
| 160 | ->setAttribute('icon', 'fa fa-cubes'); |
||
| 161 | |||
| 162 | $divers->addChild('tva', ['route' => 'tva', 'label' => 'gestock.settings.diverse.vat']) |
||
| 163 | ->setAttribute('icon', 'glyphicon glyphicon-piggy-bank'); |
||
| 164 | |||
| 165 | $divers->addChild('material', ['route' => 'material', 'label' => 'menu.material']) |
||
| 166 | ->setAttribute('icon', 'fa fa-pie-chart'); |
||
| 167 | |||
| 168 | return $menu; |
||
| 169 | } |
||
| 170 | |||
| 216 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.