Conditions | 4 |
Paths | 2 |
Total Lines | 59 |
Code Lines | 32 |
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 | <?php |
||
47 | function getSummaryPageContent() { |
||
48 | $hp = Codendi_HTMLPurifier::instance(); |
||
49 | $user = UserManager::instance()->getCurrentUser(); |
||
50 | $ret = array( |
||
51 | 'title' => $GLOBALS['Language']->getText('include_project_home','latest_file_releases'), |
||
52 | 'content' => '' |
||
53 | ); |
||
54 | |||
55 | $packages = $this->_getPackagesForUser($user->getId()); |
||
56 | if (count($packages)) { |
||
57 | $ret['content'] .= ' |
||
58 | <table cellspacing="1" cellpadding="5" width="100%" border="0"> |
||
59 | <tr class="boxitem"> |
||
60 | <td> |
||
61 | '.$GLOBALS['Language']->getText('include_project_home','package').' |
||
62 | </td> |
||
63 | <td> |
||
64 | '.$GLOBALS['Language']->getText('include_project_home','version').' |
||
65 | </td> |
||
66 | <td> |
||
67 | '.$GLOBALS['Language']->getText('include_project_home','download').' |
||
68 | </td> |
||
69 | </tr> |
||
70 | '; |
||
71 | require_once('FileModuleMonitorFactory.class.php'); |
||
72 | $fmmf = new FileModuleMonitorFactory(); |
||
73 | foreach($packages as $package) { |
||
74 | // the icon is different whether the package is monitored or not |
||
75 | if ($fmmf->isMonitoring($package['package_id'], $user, false)) { |
||
76 | $monitor_img = $GLOBALS['HTML']->getImage("ic/notification_stop.png",array('alt'=>$GLOBALS['Language']->getText('include_project_home', 'stop_monitoring'), 'title'=>$GLOBALS['Language']->getText('include_project_home', 'stop_monitoring'))); |
||
77 | } else { |
||
78 | $monitor_img = $GLOBALS['HTML']->getImage("ic/notification_start.png",array('alt'=>$GLOBALS['Language']->getText('include_project_home', 'start_monitoring'), 'title'=>$GLOBALS['Language']->getText('include_project_home', 'start_monitoring'))); |
||
79 | } |
||
80 | |||
81 | $ret['content'] .= ' |
||
82 | <TR class="boxitem"> |
||
83 | <TD> |
||
84 | <B>' . $hp->purify(util_unconvert_htmlspecialchars($package['package_name']), CODENDI_PURIFIER_CONVERT_HTML) . '</B> |
||
85 | <a HREF="/file/filemodule_monitor.php?filemodule_id=' . $package['package_id'] . '&group_id='.$this->getGroupId().'">'. |
||
86 | $monitor_img . ' |
||
87 | </a> |
||
88 | </TD>'; |
||
89 | // Releases to display |
||
90 | $ret['content'] .= '<TD>'. $hp->purify($package['release_name'], CODENDI_PURIFIER_CONVERT_HTML) .' <A href="/file/shownotes.php?group_id=' . $this->getGroupId() . '&release_id=' . $package['release_id'] . '">' . |
||
91 | $GLOBALS['HTML']->getImage("ic/text.png",array('alt'=>$GLOBALS['Language']->getText('include_project_home','release_notes'), 'title'=>$GLOBALS['Language']->getText('include_project_home','release_notes'))) . ' |
||
92 | </TD> |
||
93 | <TD><A HREF="/file/showfiles.php?group_id=' . $this->getGroupId() . '&release_id=' . $package['release_id'] . '">'.$GLOBALS['Language']->getText('include_project_home','download').'</A></TD></TR>'; |
||
94 | } |
||
95 | $ret['content'] .= '</table>'; |
||
96 | } else { |
||
97 | $ret['content'] .= '<b>'. $GLOBALS['Language']->getText('include_project_home','no_files_released') .'</b>'; |
||
98 | } |
||
99 | $ret['content'] .= ' |
||
100 | <div align="center"> |
||
101 | <a href="/file/showfiles.php?group_id='.$this->getGroupId().'">['.$GLOBALS['Language']->getText('include_project_home','view_all_files').']</A> |
||
102 | </div> |
||
103 | '; |
||
104 | return $ret; |
||
105 | } |
||
106 | |||
170 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.