We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 19 |
Paths | 140 |
Total Lines | 83 |
Code Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
130 | protected function getMenuEntry(array $entry, $recursive = false) |
||
131 | { |
||
132 | $entry = $this->resolveMenuEntry($entry); |
||
133 | |||
134 | $entryArray = []; |
||
135 | // Set "title", "volume", "type" and "pagination" from $entry array. |
||
136 | $entryArray['title'] = !empty($entry['label']) ? $entry['label'] : $entry['orderlabel']; |
||
137 | $entryArray['volume'] = $entry['volume']; |
||
138 | $entryArray['orderlabel'] = $entry['orderlabel']; |
||
139 | $entryArray['type'] = $this->getTranslatedType($entry['type']); |
||
140 | $entryArray['pagination'] = htmlspecialchars($entry['pagination']); |
||
141 | $entryArray['_OVERRIDE_HREF'] = ''; |
||
142 | $entryArray['doNotLinkIt'] = 1; |
||
143 | $entryArray['ITEM_STATE'] = 'NO'; |
||
144 | // Build menu links based on the $entry['points'] array. |
||
145 | if ( |
||
146 | !empty($entry['points']) |
||
147 | && MathUtility::canBeInterpretedAsInteger($entry['points']) |
||
148 | ) { |
||
149 | $entryArray['page'] = $entry['points']; |
||
150 | |||
151 | $entryArray['doNotLinkIt'] = 0; |
||
152 | if ($this->settings['basketButton']) { |
||
153 | $entryArray['basketButton'] = [ |
||
154 | 'logId' => $entry['id'], |
||
155 | 'startpage' => $entry['points'] |
||
156 | ]; |
||
157 | } |
||
158 | } elseif ( |
||
159 | !empty($entry['points']) |
||
160 | && is_string($entry['points']) |
||
161 | ) { |
||
162 | $entryArray['id'] = $entry['points']; |
||
163 | $entryArray['page'] = 1; |
||
164 | $entryArray['doNotLinkIt'] = 0; |
||
165 | if ($this->settings['basketButton']) { |
||
166 | $entryArray['basketButton'] = [ |
||
167 | 'logId' => $entry['id'], |
||
168 | 'startpage' => $entry['points'] |
||
169 | ]; |
||
170 | } |
||
171 | } elseif (!empty($entry['targetUid'])) { |
||
172 | $entryArray['id'] = $entry['targetUid']; |
||
173 | $entryArray['page'] = 1; |
||
174 | $entryArray['doNotLinkIt'] = 0; |
||
175 | if ($this->settings['basketButton']) { |
||
176 | $entryArray['basketButton'] = [ |
||
177 | 'logId' => $entry['id'], |
||
178 | 'startpage' => $entry['targetUid'] |
||
179 | ]; |
||
180 | } |
||
181 | } |
||
182 | // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
||
183 | if (in_array($entry['id'], $this->activeEntries)) { |
||
184 | $entryArray['ITEM_STATE'] = 'CUR'; |
||
185 | } |
||
186 | // Build sub-menu if available and called recursively. |
||
187 | if ( |
||
188 | $recursive === true |
||
189 | && !empty($entry['children']) |
||
190 | ) { |
||
191 | // Build sub-menu only if one of the following conditions apply: |
||
192 | // 1. Current menu node is in rootline |
||
193 | // 2. Current menu node points to another file |
||
194 | // 3. Current menu node has no corresponding images |
||
195 | if ( |
||
196 | $entryArray['ITEM_STATE'] == 'CUR' |
||
197 | || is_string($entry['points']) |
||
198 | || empty($this->document->getDoc()->smLinks['l2p'][$entry['id']]) |
||
199 | ) { |
||
200 | $entryArray['_SUB_MENU'] = []; |
||
201 | foreach ($entry['children'] as $child) { |
||
202 | // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
||
203 | if (in_array($child['id'], $this->activeEntries)) { |
||
204 | $entryArray['ITEM_STATE'] = 'ACT'; |
||
205 | } |
||
206 | $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, true); |
||
207 | } |
||
208 | } |
||
209 | // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
||
210 | $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'] . 'IFSUB'); |
||
211 | } |
||
212 | return $entryArray; |
||
213 | } |
||
277 |
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.