Conditions | 37 |
Paths | 272 |
Total Lines | 182 |
Code Lines | 74 |
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 |
||
66 | function template_unread() |
||
67 | { |
||
68 | global $context, $txt, $scripturl, $modSettings, $board_info; |
||
69 | |||
70 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
||
71 | if (!empty($context['recent_buttons'])) |
||
72 | echo ' |
||
73 | <div id="mobile_action" class="popup_container"> |
||
74 | <div class="popup_window description"> |
||
75 | <div class="popup_heading"> |
||
76 | ', $txt['mobile_action'], ' |
||
77 | <a href="javascript:void(0);" class="main_icons hide_popup"></a> |
||
78 | </div> |
||
79 | ', template_button_strip($context['recent_buttons']), ' |
||
|
|||
80 | </div> |
||
81 | </div>'; |
||
82 | |||
83 | echo ' |
||
84 | <div id="recent" class="main_content"> |
||
85 | <div id="display_head" class="information"> |
||
86 | <h2 class="display_title"> |
||
87 | <span>', (!empty($board_info['name']) ? $board_info['name'] . ' - ' : '') . $context['page_title'], '</span> |
||
88 | </h2> |
||
89 | </div>'; |
||
90 | |||
91 | if ($context['showCheckboxes']) |
||
92 | echo ' |
||
93 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm"> |
||
94 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||
95 | <input type="hidden" name="qaction" value="markread"> |
||
96 | <input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
||
97 | |||
98 | if (!empty($context['topics'])) |
||
99 | { |
||
100 | echo ' |
||
101 | <div class="pagesection"> |
||
102 | ', $context['menu_separator'], ' |
||
103 | <div class="pagelinks floatleft"> |
||
104 | <a href="#bot" class="button">', $txt['go_down'], '</a> |
||
105 | ', $context['page_index'], ' |
||
106 | </div> |
||
107 | ', !empty($context['recent_buttons']) ? template_button_strip($context['recent_buttons'], 'right') : ''; |
||
108 | |||
109 | // Mobile action (top) |
||
110 | if (!empty($context['recent_buttons'])) |
||
111 | echo ' |
||
112 | <div class="mobile_buttons floatright"> |
||
113 | <a class="button mobile_act">', $txt['mobile_action'], '</a> |
||
114 | </div>'; |
||
115 | |||
116 | echo ' |
||
117 | </div>'; |
||
118 | |||
119 | echo ' |
||
120 | <div id="unread"> |
||
121 | <div id="topic_header" class="title_bar"> |
||
122 | <div class="board_icon"></div> |
||
123 | <div class="info"> |
||
124 | <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
125 | </div> |
||
126 | <div class="board_stats centertext"> |
||
127 | <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
128 | </div> |
||
129 | <div class="lastpost"> |
||
130 | <a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <span class="main_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
||
131 | </div>'; |
||
132 | |||
133 | // Show a "select all" box for quick moderation? |
||
134 | if ($context['showCheckboxes']) |
||
135 | echo ' |
||
136 | <div class="moderation"> |
||
137 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
||
138 | </div>'; |
||
139 | |||
140 | echo ' |
||
141 | </div><!-- #topic_header --> |
||
142 | <div id="topic_container">'; |
||
143 | |||
144 | foreach ($context['topics'] as $topic) |
||
145 | { |
||
146 | echo ' |
||
147 | <div class="', $topic['css_class'], '"> |
||
148 | <div class="board_icon"> |
||
149 | <img src="', $topic['first_post']['icon_url'], '" alt=""> |
||
150 | ', $topic['is_posted_in'] ? '<span class="main_icons profile_sm"></span>' : '', ' |
||
151 | </div> |
||
152 | <div class="info">'; |
||
153 | |||
154 | // Now we handle the icons |
||
155 | echo ' |
||
156 | <div class="icons floatright">'; |
||
157 | |||
158 | if ($topic['is_locked']) |
||
159 | echo ' |
||
160 | <span class="main_icons lock"></span>'; |
||
161 | |||
162 | if ($topic['is_sticky']) |
||
163 | echo ' |
||
164 | <span class="main_icons sticky"></span>'; |
||
165 | |||
166 | if ($topic['is_poll']) |
||
167 | echo ' |
||
168 | <span class="main_icons poll"></span>'; |
||
169 | |||
170 | echo ' |
||
171 | </div>'; |
||
172 | |||
173 | echo ' |
||
174 | <div class="recent_title"> |
||
175 | <a href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '" class="new_posts">' . $txt['new'] . '</a> |
||
176 | ', $topic['is_sticky'] ? '<strong>' : '', '<span class="preview" title="', $topic[(empty($modSettings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span></span>', $topic['is_sticky'] ? '</strong>' : '', ' |
||
177 | </div> |
||
178 | <p class="floatleft"> |
||
179 | ', $topic['first_post']['started_by'], ' |
||
180 | </p> |
||
181 | ', !empty($topic['pages']) ? '<span id="pages' . $topic['first_post']['id'] . '" class="topic_pages">' . $topic['pages'] . '</span>' : '', ' |
||
182 | </div><!-- .info --> |
||
183 | <div class="board_stats centertext"> |
||
184 | <p> |
||
185 | ', $topic['replies'], ' ', $txt['replies'], ' |
||
186 | <br> |
||
187 | ', $topic['views'], ' ', $txt['views'], ' |
||
188 | </p> |
||
189 | </div> |
||
190 | <div class="lastpost"> |
||
191 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
||
192 | </div>'; |
||
193 | |||
194 | if ($context['showCheckboxes']) |
||
195 | echo ' |
||
196 | <div class="moderation"> |
||
197 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
||
198 | </div>'; |
||
199 | |||
200 | echo ' |
||
201 | </div><!-- $topic[css_class] -->'; |
||
202 | } |
||
203 | |||
204 | if (empty($context['topics'])) |
||
205 | echo ' |
||
206 | <div style="display: none;"></div>'; |
||
207 | |||
208 | echo ' |
||
209 | </div><!-- #topic_container --> |
||
210 | </div><!-- #unread -->'; |
||
211 | |||
212 | echo ' |
||
213 | <div class="pagesection"> |
||
214 | ', !empty($context['recent_buttons']) ? template_button_strip($context['recent_buttons'], 'right') : '', ' |
||
215 | ', $context['menu_separator'], ' |
||
216 | <div class="pagelinks floatleft"> |
||
217 | <a href="#recent" class="button" id="bot">', $txt['go_up'], '</a> |
||
218 | ', $context['page_index'], ' |
||
219 | </div>'; |
||
220 | |||
221 | // Mobile action (bottom) |
||
222 | if (!empty($context['recent_buttons'])) |
||
223 | echo ' |
||
224 | <div class="mobile_buttons floatright"> |
||
225 | <a class="button mobile_act">', $txt['mobile_action'], '</a> |
||
226 | </div>'; |
||
227 | |||
228 | echo ' |
||
229 | </div>'; |
||
230 | } |
||
231 | else |
||
232 | echo ' |
||
233 | <div class="infobox"> |
||
234 | <p class="centertext"> |
||
235 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : sprintf($txt['unread_topics_visit_none'], $scripturl), ' |
||
236 | </p> |
||
237 | </div>'; |
||
238 | |||
239 | if ($context['showCheckboxes']) |
||
240 | echo ' |
||
241 | </form>'; |
||
242 | |||
243 | echo ' |
||
244 | </div><!-- #recent -->'; |
||
245 | |||
246 | if (empty($context['no_topic_listing'])) |
||
247 | template_topic_legend(); |
||
248 | } |
||
431 | ?> |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.