Conditions | 1 |
Paths | 1 |
Total Lines | 90 |
Code Lines | 66 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 |
||
103 | public function configureMenuItems(): iterable |
||
104 | { |
||
105 | $mathematically_checking = MenuItem::linkToCrud('payment_order.mathematically_checking_needed', '', PaymentOrder::class) |
||
106 | ->setDefaultSort([ |
||
107 | 'creation_date' => 'ASC', |
||
108 | ]); |
||
109 | $this->addFiltersToMenuItem($mathematically_checking, [ |
||
110 | 'mathematically_correct' => 0, |
||
111 | 'confirmed' => 1, |
||
112 | ]); |
||
113 | |||
114 | $ready_for_export_section = MenuItem::linkToCrud('payment_order.ready_for_export.section', '', PaymentOrder::class) |
||
115 | ->setDefaultSort([ |
||
116 | 'creation_date' => 'ASC', |
||
117 | ]); |
||
118 | $this->addFiltersToMenuItem($ready_for_export_section, [ |
||
119 | 'mathematically_correct' => 1, |
||
120 | 'exported' => 0, |
||
121 | 'confirmed' => 1, |
||
122 | ]); |
||
123 | |||
124 | $factually_checking_fsr = MenuItem::linkToCrud('payment_order.factually_checking_needed.fsr', '', PaymentOrder::class) |
||
125 | ->setDefaultSort([ |
||
126 | 'creation_date' => 'ASC', |
||
127 | ]); |
||
128 | $this->addFiltersToMenuItem($factually_checking_fsr, [ |
||
129 | 'factually_correct' => 0, |
||
130 | 'department_type' => 'fsr', |
||
131 | 'exported' => 1, |
||
132 | 'confirmed' => 1, |
||
133 | ]); |
||
134 | |||
135 | $factually_checking_section = MenuItem::linkToCrud('payment_order.factually_checking_needed.section', '', PaymentOrder::class) |
||
136 | ->setDefaultSort([ |
||
137 | 'creation_date' => 'ASC', |
||
138 | ]); |
||
139 | $this->addFiltersToMenuItem($factually_checking_section, [ |
||
140 | 'factually_correct' => 0, |
||
141 | 'department_type' => 'section_misc', |
||
142 | 'exported' => 1, |
||
143 | 'confirmed' => 1, |
||
144 | ]); |
||
145 | |||
146 | $finished = MenuItem::linkToCrud('payment_order.finished', '', PaymentOrder::class) |
||
147 | ->setDefaultSort([ |
||
148 | 'creation_date' => 'DESC', |
||
149 | ]); |
||
150 | $this->addFiltersToMenuItem($finished, [ |
||
151 | 'factually_correct' => 1, |
||
152 | 'mathematically_correct' => 1, |
||
153 | 'exported' => 1, |
||
154 | 'confirmed' => 1, |
||
155 | ]); |
||
156 | |||
157 | $unconfirmed = MenuItem::linkToCrud('payment_order.unconfirmed', '', PaymentOrder::class) |
||
158 | ->setDefaultSort([ |
||
159 | 'creation_date' => 'ASC', |
||
160 | ]); |
||
161 | $this->addFiltersToMenuItem($unconfirmed, [ |
||
162 | 'confirmed' => 0, |
||
163 | ]); |
||
164 | |||
165 | $items = [ |
||
166 | $mathematically_checking, |
||
167 | $ready_for_export_section, |
||
168 | $factually_checking_fsr, |
||
169 | $factually_checking_section, |
||
170 | $finished, |
||
171 | $unconfirmed, |
||
172 | MenuItem::linkToCrud('payment_order.all', '', PaymentOrder::class), |
||
173 | ]; |
||
174 | |||
175 | yield MenuItem::subMenu('payment_order.labelp', 'fas fa-file-invoice-dollar') |
||
176 | ->setPermission('ROLE_SHOW_PAYMENT_ORDERS') |
||
177 | ->setSubItems($items); |
||
178 | |||
179 | yield MenuItem::linkToCrud('department.labelp', 'fas fa-sitemap', Department::class) |
||
180 | ->setPermission('ROLE_READ_ORGANISATIONS'); |
||
181 | yield MenuItem::linkToCrud('bank_account.labelp', 'fas fa-university', BankAccount::class) |
||
182 | ->setPermission('ROLE_READ_BANK_ACCOUNTS'); |
||
183 | yield MenuItem::linkToCrud('user.labelp', 'fas fa-user', User::class) |
||
184 | ->setPermission('ROLE_READ_USER'); |
||
185 | |||
186 | $version = $this->app_version.'-'.$this->gitVersionInfo->getGitCommitHash() ?? ''; |
||
187 | yield MenuItem::section('Version '.$version, 'fas fa-info'); |
||
188 | yield MenuItem::linktoRoute('dashboard.menu.audits', 'fas fa-binoculars', 'dh_auditor_list_audits') |
||
189 | ->setPermission('ROLE_VIEW_AUDITS'); |
||
190 | yield MenuItem::linktoRoute('dashboard.menu.homepage', 'fas fa-home', 'homepage'); |
||
191 | yield MenuItem::linkToUrl('dashboard.menu.stura', 'fab fa-rebel', 'https://www.stura.uni-jena.de/'); |
||
192 | yield MenuItem::linkToUrl('dashboard.menu.github', 'fab fa-github', 'https://github.com/jbtronics/StuRa-Finanzsoftware'); |
||
193 | } |
||
220 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.