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 | 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 |
||
47 | protected function getMenuEntry(array $entry, $recursive = false) |
||
48 | { |
||
49 | $entry = $this->resolveMenuEntry($entry); |
||
50 | |||
51 | $entryArray = []; |
||
52 | // Set "title", "volume", "type" and "pagination" from $entry array. |
||
53 | $entryArray['title'] = !empty($entry['label']) ? $entry['label'] : $entry['orderlabel']; |
||
54 | $entryArray['volume'] = $entry['volume']; |
||
55 | $entryArray['orderlabel'] = $entry['orderlabel']; |
||
56 | $entryArray['type'] = Helper::translate($entry['type'], 'tx_dlf_structures', $this->settings['storagePid']); |
||
57 | $entryArray['pagination'] = htmlspecialchars($entry['pagination']); |
||
58 | $entryArray['_OVERRIDE_HREF'] = ''; |
||
59 | $entryArray['doNotLinkIt'] = 1; |
||
60 | $entryArray['ITEM_STATE'] = 'NO'; |
||
61 | // Build menu links based on the $entry['points'] array. |
||
62 | if ( |
||
63 | !empty($entry['points']) |
||
64 | && MathUtility::canBeInterpretedAsInteger($entry['points']) |
||
65 | ) { |
||
66 | $entryArray['page'] = $entry['points']; |
||
67 | |||
68 | $entryArray['doNotLinkIt'] = 0; |
||
69 | if ($this->settings['basketButton']) { |
||
70 | $entryArray['basketButton'] = [ |
||
71 | 'logId' => $entry['id'], |
||
72 | 'startpage' => $entry['points'] |
||
73 | ]; |
||
74 | } |
||
75 | } elseif ( |
||
76 | !empty($entry['points']) |
||
77 | && is_string($entry['points']) |
||
78 | ) { |
||
79 | $entryArray['id'] = $entry['points']; |
||
80 | $entryArray['page'] = 1; |
||
81 | $entryArray['doNotLinkIt'] = 0; |
||
82 | if ($this->settings['basketButton']) { |
||
83 | $entryArray['basketButton'] = [ |
||
84 | 'logId' => $entry['id'], |
||
85 | 'startpage' => $entry['points'] |
||
86 | ]; |
||
87 | } |
||
88 | } elseif (!empty($entry['targetUid'])) { |
||
89 | $entryArray['id'] = $entry['targetUid']; |
||
90 | $entryArray['page'] = 1; |
||
91 | $entryArray['doNotLinkIt'] = 0; |
||
92 | if ($this->settings['basketButton']) { |
||
93 | $entryArray['basketButton'] = [ |
||
94 | 'logId' => $entry['id'], |
||
95 | 'startpage' => $entry['targetUid'] |
||
96 | ]; |
||
97 | } |
||
98 | } |
||
99 | // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
||
100 | if (in_array($entry['id'], $this->activeEntries)) { |
||
101 | $entryArray['ITEM_STATE'] = 'CUR'; |
||
102 | } |
||
103 | // Build sub-menu if available and called recursively. |
||
104 | if ( |
||
105 | $recursive === true |
||
106 | && !empty($entry['children']) |
||
107 | ) { |
||
108 | // Build sub-menu only if one of the following conditions apply: |
||
109 | // 1. Current menu node is in rootline |
||
110 | // 2. Current menu node points to another file |
||
111 | // 3. Current menu node has no corresponding images |
||
112 | if ( |
||
113 | $entryArray['ITEM_STATE'] == 'CUR' |
||
114 | || is_string($entry['points']) |
||
115 | || empty($this->document->getDoc()->smLinks['l2p'][$entry['id']]) |
||
116 | ) { |
||
117 | $entryArray['_SUB_MENU'] = []; |
||
118 | foreach ($entry['children'] as $child) { |
||
119 | // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
||
120 | if (in_array($child['id'], $this->activeEntries)) { |
||
121 | $entryArray['ITEM_STATE'] = 'ACT'; |
||
122 | } |
||
123 | $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, true); |
||
124 | } |
||
125 | } |
||
126 | // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
||
127 | $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'] . 'IFSUB'); |
||
128 | } |
||
129 | return $entryArray; |
||
130 | } |
||
259 |
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.