Conditions | 19 |
Paths | 70 |
Total Lines | 100 |
Code Lines | 35 |
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 |
||
42 | protected function getMenuEntry(array $entry, $recursive = FALSE) { |
||
43 | |||
44 | $entryArray = array (); |
||
45 | |||
46 | // Set "title", "volume", "type" and "pagination" from $entry array. |
||
47 | $entryArray['title'] = $entry['label']; |
||
48 | |||
49 | $entryArray['volume'] = $entry['volume']; |
||
50 | |||
51 | $entryArray['orderlabel'] = $entry['orderlabel']; |
||
52 | |||
53 | $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']); |
||
54 | |||
55 | $entryArray['pagination'] = $entry['pagination']; |
||
56 | |||
57 | $entryArray['_OVERRIDE_HREF'] = ''; |
||
58 | |||
59 | $entryArray['doNotLinkIt'] = 1; |
||
60 | |||
61 | $entryArray['ITEM_STATE'] = 'NO'; |
||
62 | |||
63 | // Build menu links based on the $entry['points'] array. |
||
64 | if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) { |
||
|
|||
65 | |||
66 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']); |
||
67 | |||
68 | $entryArray['doNotLinkIt'] = 0; |
||
69 | |||
70 | if ($this->conf['basketButton']) { |
||
71 | |||
72 | $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>'; |
||
73 | |||
74 | } |
||
75 | |||
76 | } elseif (!empty($entry['points']) && is_string($entry['points'])) { |
||
77 | |||
78 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
||
79 | |||
80 | $entryArray['doNotLinkIt'] = 0; |
||
81 | |||
82 | if ($this->conf['basketButton']) { |
||
83 | |||
84 | $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['points']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>'; |
||
85 | |||
86 | } |
||
87 | |||
88 | } elseif (!empty($entry['targetUid'])) { |
||
89 | |||
90 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); |
||
91 | |||
92 | $entryArray['doNotLinkIt'] = 0; |
||
93 | |||
94 | if ($this->conf['basketButton']) { |
||
95 | |||
96 | $entryArray['basketButtonHref'] = '<a href="'.$this->pi_linkTP_keepPIvars_url(array ('addToBasket' => 'toc', 'logId' => $entry['id'], 'startpage' => $entry['targetUid']), TRUE, FALSE, $this->conf['targetBasket']).'">'.$this->pi_getLL('basketButton', '', TRUE).'</a>'; |
||
97 | |||
98 | } |
||
99 | |||
100 | } |
||
101 | |||
102 | // Set "ITEM_STATE" to "CUR" if this entry points to current page. |
||
103 | if (in_array($entry['id'], $this->activeEntries)) { |
||
104 | |||
105 | $entryArray['ITEM_STATE'] = 'CUR'; |
||
106 | |||
107 | } |
||
108 | |||
109 | // Build sub-menu if available and called recursively. |
||
110 | if ($recursive == TRUE && !empty($entry['children'])) { |
||
111 | |||
112 | // Build sub-menu only if one of the following conditions apply: |
||
113 | // 1. "expAll" is set for menu |
||
114 | // 2. Current menu node is in rootline |
||
115 | // 3. Current menu node points to another file |
||
116 | // 4. Current menu node has no corresponding images |
||
117 | if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) { |
||
118 | |||
119 | $entryArray['_SUB_MENU'] = array (); |
||
120 | |||
121 | foreach ($entry['children'] as $child) { |
||
122 | |||
123 | // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. |
||
124 | if (in_array($child['id'], $this->activeEntries)) { |
||
125 | |||
126 | $entryArray['ITEM_STATE'] = 'ACT'; |
||
127 | |||
128 | } |
||
129 | |||
130 | $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE); |
||
131 | |||
132 | } |
||
133 | |||
134 | } |
||
135 | |||
136 | // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. |
||
137 | $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); |
||
138 | |||
139 | } |
||
140 | |||
141 | return $entryArray; |
||
142 | |||
329 |
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