Conditions | 4 |
Paths | 6 |
Total Lines | 53 |
Code Lines | 34 |
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 |
||
70 | public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string |
||
71 | { |
||
72 | $gedcomid = $tree->getUserPreference(Auth::user(), UserInterface::PREF_TREE_ACCOUNT_XREF); |
||
73 | $individual = Registry::individualFactory()->make($gedcomid, $tree); |
||
74 | $links = []; |
||
75 | |||
76 | $pedigree_chart = $this->module_service |
||
77 | ->findByComponent(ModuleChartInterface::class, $tree, Auth::user()) |
||
78 | ->first(static fn (ModuleInterface $module): bool => $module instanceof PedigreeChartModule); |
||
79 | |||
80 | if ($individual instanceof Individual) { |
||
81 | if ($pedigree_chart instanceof PedigreeChartModule) { |
||
82 | $links[] = [ |
||
83 | 'url' => $pedigree_chart->chartUrl($individual), |
||
84 | 'title' => I18N::translate('Default chart'), |
||
85 | 'class' => 'icon-pedigree', |
||
86 | 'icon' => view('icons/pedigree-right'), |
||
87 | ]; |
||
88 | } |
||
89 | |||
90 | $links[] = [ |
||
91 | 'url' => $individual->url(), |
||
92 | 'title' => I18N::translate('My individual record'), |
||
93 | 'class' => 'icon-indis', |
||
94 | 'icon' => view('icons/user'), |
||
95 | ]; |
||
96 | } |
||
97 | |||
98 | $links[] = [ |
||
99 | 'url' => route(AccountEdit::class, ['tree' => $tree->name()]), |
||
100 | 'title' => I18N::translate('My account'), |
||
101 | 'class' => 'icon-mypage', |
||
102 | 'icon' => view('icons/account'), |
||
103 | ]; |
||
104 | |||
105 | $content = view('modules/user_welcome/welcome', ['links' => $links]); |
||
106 | |||
107 | $real_name = "\u{2068}" . e(Auth::user()->realName()) . "\u{2069}"; |
||
108 | |||
109 | /* I18N: A %s is the user’s name */ |
||
110 | $title = I18N::translate('Welcome %s', $real_name); |
||
111 | |||
112 | if ($context !== self::CONTEXT_EMBED) { |
||
113 | return view('modules/block-template', [ |
||
114 | 'block' => Str::kebab($this->name()), |
||
115 | 'id' => $block_id, |
||
116 | 'config_url' => '', |
||
117 | 'title' => $title, |
||
118 | 'content' => $content, |
||
119 | ]); |
||
120 | } |
||
121 | |||
122 | return $content; |
||
123 | } |
||
157 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths