Conditions | 1 |
Paths | 1 |
Total Lines | 77 |
Code Lines | 47 |
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 |
||
201 | public static function renderError($errno, $errorname, $errstr, $errfile, $errline, $errcontext) |
||
202 | { |
||
203 | // shorten errorfile string by removing the root path |
||
204 | $errfile_short = str_replace(APPLICATION_PATH, '', $errfile); |
||
205 | $short_errorstring = \Koch\Functions\Functions::shortenString($errfile, 70, '...'); |
||
206 | |||
207 | // Header |
||
208 | $html = '<html><head>'; |
||
209 | $html .= '<title>Koch Framework Error</title>'; |
||
210 | $html .= '<link rel="stylesheet" href="' . WWW_ROOT_THEMES_CORE . 'css/error.css" type="text/css" />'; |
||
211 | $html .= '</head>'; |
||
212 | |||
213 | // Body |
||
214 | $html .= '<body>'; |
||
215 | |||
216 | // Fieldset with Legend |
||
217 | $html .= '<fieldset id="top" class="error_red">'; |
||
218 | $html .= '<legend>Koch Framework Error</legend>'; |
||
219 | |||
220 | // Add Errorlogo |
||
221 | $html .= '<div style="float: left; margin: 5px; margin-right: 25px; padding: 20px;">'; |
||
222 | $html .= '<img src="' . WWW_ROOT_THEMES_CORE . 'images/Clansuite-Toolbar-Icon-64-error.png"'; |
||
223 | $html .= ' style="border: 2px groove #000000;"/></div>'; |
||
224 | |||
225 | // Open Error Table |
||
226 | $html .= '<table width="80%"><tr><td>'; |
||
227 | |||
228 | // Panel 1 - Errormessage |
||
229 | $html .= '<div id="panel1" class="panel">'; |
||
230 | $html .= '<h3>Error - ' . $errorname . ' (' . $errno . ')</h3> '; |
||
231 | $html .= '<p style="font-weight: bold;">' . $errstr . '</p>'; |
||
232 | $html .= '<p>in file "<span style="font-weight: bold;">' . $errfile_short . '</span>"'; |
||
233 | $html .= ' on line #<span style="font-weight: bold;">' . $errline . '.</span></p>'; |
||
234 | $html .= '</div>'; |
||
235 | |||
236 | // Panel 2 - Error Context |
||
237 | $html .= '<div id="panel2" class="panel">'; |
||
238 | $html .= '<h3>Context</h3>'; |
||
239 | $html .= '<p><span class="small">You are viewing the source code of the file "'; |
||
240 | $html .= $errfile . '" around line ' . $errline . '.</span></p>'; |
||
241 | $html .= Errorhandler::getErrorContext($errfile, $errline, 8) . '</div>'; |
||
242 | |||
243 | // Panel 3 - Debug Backtracing |
||
244 | $html .= Errorhandler::getDebugBacktrace($short_errorstring); |
||
245 | |||
246 | // Panel 4 - Environmental Informations at Errortime |
||
247 | $html .= '<div id="panel4" class="panel">'; |
||
248 | $html .= '<h3>Server Environment</h3>'; |
||
249 | $html .= '<p><table width="95%">'; |
||
250 | $html .= '<tr><td colspan="2"></td></tr>'; |
||
251 | $html .= '<tr><td><strong>Date: </strong></td><td>' . date('r') . '</td></tr>'; |
||
252 | $html .= '<tr><td><strong>Remote: </strong></td><td>' . $_SERVER['REMOTE_ADDR'] . '</td></tr>'; |
||
253 | $html .= '<tr><td><strong>Request: </strong></td><td>' . htmlentities($_SERVER['QUERY_STRING'], ENT_QUOTES); |
||
254 | $html .= '</td></tr>'; |
||
255 | $html .= '<tr><td><strong>PHP: </strong></td><td>' . PHP_VERSION . ' ' . PHP_EXTRA_VERSION . '</td></tr>'; |
||
256 | $html .= '<tr><td><strong>Server: </strong></td><td>' . $_SERVER['SERVER_SOFTWARE'] . '</td></tr>'; |
||
257 | $html .= '<tr><td><strong>Agent: </strong></td><td>' . $_SERVER['HTTP_USER_AGENT'] . '</td></tr>'; |
||
258 | $html .= '<tr><td><strong>Clansuite: </strong></td><td>'; |
||
259 | $html .= APPLICATION_VERSION . ' ' . APPLICATION_VERSION_STATE . ' (' . APPLICATION_VERSION_NAME . ')'; |
||
260 | $html .= '</td></tr>'; |
||
261 | $html .= '</table></p></div>'; |
||
262 | |||
263 | // Panel 5 - Backlink to Bugtracker with Errormessage -> http://trac.clansuite.com/newticket |
||
264 | $html .= Errorhandler::getBugtrackerBacklinks($errorname, $errfile, $errline, $errcontext); |
||
265 | |||
266 | // Close Error Table |
||
267 | $html .= '</table>'; |
||
268 | |||
269 | // Add Footer with Support-Backlinks |
||
270 | $html .= Errorhandler::getSupportBacklinks(); |
||
271 | |||
272 | // Close all html elements |
||
273 | $html .= '</fieldset><br /><br />'; |
||
274 | $html .= '</body></html>'; |
||
275 | |||
276 | return $html; |
||
277 | } |
||
278 | } |
||
279 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.