Conditions | 7 |
Paths | 32 |
Total Lines | 63 |
Code Lines | 47 |
Lines | 0 |
Ratio | 0 % |
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 |
||
41 | public function build(edulegit_submission_entity $edulegitsubmission): \action_menu { |
||
|
|||
42 | $emptyicon = new \pix_icon('', ''); |
||
43 | |||
44 | $menu = new \action_menu(); |
||
45 | |||
46 | $title = $edulegitsubmission->title ?: $this->translate('submission'); |
||
47 | $menu->actionicon = $emptyicon; |
||
48 | $menu->actiontext = shorten_text($title, 32); |
||
49 | $menu->set_action_label($title); |
||
50 | |||
51 | $viewurl = $edulegitsubmission->get_view_url(); |
||
52 | if ($viewurl) { |
||
53 | $menu->add( |
||
54 | new \action_menu_link( |
||
55 | new \moodle_url($viewurl), |
||
56 | $emptyicon, |
||
57 | $this->translate('as_view'), |
||
58 | false |
||
59 | )); |
||
60 | } |
||
61 | |||
62 | $pdfurl = $edulegitsubmission->get_pdf_url(); |
||
63 | if ($pdfurl) { |
||
64 | $menu->add( |
||
65 | new \action_menu_link( |
||
66 | new \moodle_url($pdfurl), |
||
67 | $emptyicon, |
||
68 | $this->translate('as_pdf'), |
||
69 | false |
||
70 | )); |
||
71 | } |
||
72 | $docxurl = $edulegitsubmission->get_docx_url(); |
||
73 | if ($docxurl) { |
||
74 | $menu->add( |
||
75 | new \action_menu_link( |
||
76 | new \moodle_url($docxurl), |
||
77 | $emptyicon, |
||
78 | $this->translate('as_docx'), |
||
79 | false |
||
80 | )); |
||
81 | } |
||
82 | $htmlurl = $edulegitsubmission->get_html_url(); |
||
83 | if ($htmlurl) { |
||
84 | $menu->add( |
||
85 | new \action_menu_link( |
||
86 | new \moodle_url($htmlurl), |
||
87 | $emptyicon, |
||
88 | $this->translate('as_html'), |
||
89 | false |
||
90 | )); |
||
91 | } |
||
92 | $txturl = $edulegitsubmission->get_txt_url(); |
||
93 | if ($txturl) { |
||
94 | $menu->add( |
||
95 | new \action_menu_link( |
||
96 | new \moodle_url($txturl), |
||
97 | $emptyicon, |
||
98 | $this->translate('as_txt'), |
||
99 | false |
||
100 | )); |
||
101 | } |
||
102 | |||
103 | return $menu; |
||
104 | } |
||
117 |
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