| Conditions | 2 |
| Paths | 1 |
| Total Lines | 63 |
| Code Lines | 45 |
| 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 |
||
| 11 | public function register() |
||
| 12 | { |
||
| 13 | Menu::macro('back', function () { |
||
| 14 | return Menu::new() |
||
| 15 | ->setActiveClass('-active') |
||
| 16 | ->setActiveFromRequest('/blender'); |
||
| 17 | }); |
||
| 18 | |||
| 19 | Menu::macro('moduleGroup', function ($title) { |
||
| 20 | return Menu::back() |
||
| 21 | ->addParentClass('menu__group') |
||
| 22 | ->setParentAttribute('data-menu-group', fragment("back.nav.{$title}")) |
||
| 23 | ->registerFilter(function (Link $link) { |
||
| 24 | $link->addParentClass('menu__group__item'); |
||
| 25 | }); |
||
| 26 | }); |
||
| 27 | |||
| 28 | Menu::macro('module', function (string $action, string $name) { |
||
| 29 | return $this->action("Back\\{$action}", fragment("back.{$name}")); |
||
|
|
|||
| 30 | }); |
||
| 31 | |||
| 32 | Menu::macro('backMain', function () { |
||
| 33 | return Menu::back() |
||
| 34 | ->addClass('menu__groups') |
||
| 35 | ->setAttribute('data-menu-groups') |
||
| 36 | ->add(Menu::moduleGroup('content') |
||
| 37 | ->module('ArticlesController@index', 'articles.title') |
||
| 38 | ->module('NewsController@index', 'news.title') |
||
| 39 | ->module('PeopleController@index', 'people.title')) |
||
| 40 | ->add(Menu::moduleGroup('modules') |
||
| 41 | ->module('FragmentsController@index', 'fragments.title') |
||
| 42 | ->module('FormResponsesController@showDownloadButton', 'formResponses.title') |
||
| 43 | ->module('TagsController@index', 'tags.title')) |
||
| 44 | ->add(Menu::moduleGroup('users') |
||
| 45 | ->module('MembersController@index', 'members.title') |
||
| 46 | ->module('AdministratorsController@index', 'administrators.title')) |
||
| 47 | ->add(Menu::moduleGroup('system') |
||
| 48 | ->module('ActivitylogController@index', 'log.title') |
||
| 49 | ->module('RedirectsController@index', 'redirects.title') |
||
| 50 | ->module('StatisticsController@index', 'statistics.menuTitle')); |
||
| 51 | }); |
||
| 52 | |||
| 53 | Menu::macro('backUser', function () { |
||
| 54 | $avatar = Html::avatar(current_user(), '-small'). |
||
| 55 | el('span.:response-desktop-only', current_user()->email); |
||
| 56 | |||
| 57 | return Menu::new() |
||
| 58 | ->action('Back\AdministratorsController@edit', $avatar, [current_user()->id]) |
||
| 59 | ->html(view('back.auth._partials.logoutForm')); |
||
| 60 | }); |
||
| 61 | |||
| 62 | Menu::macro('breadcrumbs', function (array $breadcrumbs) { |
||
| 63 | return Menu::build($breadcrumbs, function (Menu $menu, $actionWithParameters, $label) { |
||
| 64 | if (! is_array($actionWithParameters)) { |
||
| 65 | $actionWithParameters = [$actionWithParameters]; |
||
| 66 | } |
||
| 67 | |||
| 68 | $action = array_shift($actionWithParameters); |
||
| 69 | |||
| 70 | return $menu->action($action, $label, $actionWithParameters); |
||
| 71 | })->addClass('breadcrumb')->setActiveFromRequest('/blender'); |
||
| 72 | }); |
||
| 73 | } |
||
| 74 | } |
||
| 75 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.