| Conditions | 11 |
| Paths | 11 |
| Total Lines | 37 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 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 | <? |
||
| 19 | private static function get_router_name() |
||
| 20 | { |
||
| 21 | if(Request::isAJAX()) |
||
| 22 | return 'AJAXRouter'; |
||
| 23 | if(URLDecode::getURI() == '/sitemap.xml') |
||
| 24 | return 'SitemapRouter'; |
||
| 25 | if(URLDecode::getURI() == '/rss/') |
||
| 26 | return 'RSSRouter'; |
||
| 27 | |||
| 28 | switch(URLDecode::getSite()) |
||
| 29 | { |
||
| 30 | case 'ajax' : |
||
| 31 | return 'AjaxRouter'; |
||
| 32 | break; |
||
| 33 | case 'blog' : |
||
| 34 | return 'BlogRouter'; |
||
| 35 | break; |
||
| 36 | case 'home' : |
||
| 37 | return 'HomeRouter'; |
||
| 38 | break; |
||
| 39 | case 'lifestream' : |
||
| 40 | return 'LifestreamRouter'; |
||
| 41 | break; |
||
| 42 | case 'portfolio' : |
||
| 43 | return 'PortfolioRouter'; |
||
| 44 | break; |
||
| 45 | case 'site' : |
||
| 46 | return 'SiteRouter'; |
||
| 47 | break; |
||
| 48 | case 'waterfalls' : |
||
| 49 | return 'WaterfallRouter'; |
||
| 50 | break; |
||
| 51 | } |
||
| 52 | |||
| 53 | Debugger::logMessage("The router for " . URLDecode::getSite() . " was not loaded."); |
||
| 54 | Loader::loadNew('controller', '/Error404Controller')->activate(); |
||
| 55 | } |
||
| 56 | |||
| 152 |
Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.
As a precaution to avoid these problems better use the long opening tag
<?php.