Conditions | 10 |
Paths | 129 |
Total Lines | 56 |
Code Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
38 | public function &getUserbar() |
||
39 | { |
||
40 | global $xoopsModuleConfig, $xoopsUser, $isadmin; |
||
41 | if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) { |
||
42 | return null; |
||
43 | } |
||
44 | $user = $this->user; |
||
45 | $userbar = array(); |
||
46 | $userbar[] = array( |
||
47 | 'link' => $GLOBALS['xoops']->url('userinfo.php?uid=' . $user->getVar('uid')), |
||
48 | 'name' => PROFILE |
||
|
|||
49 | ); |
||
50 | if (is_object($xoopsUser)) { |
||
51 | $userbar[] = array( |
||
52 | 'link' => "javascript:void openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $user->getVar('uid') . "','pmlite', 450, 380);", |
||
53 | 'name' => _MD_PM |
||
54 | ); |
||
55 | } |
||
56 | if ($user->getVar('user_viewemail') || $isadmin) { |
||
57 | $userbar[] = array( |
||
58 | 'link' => "javascript:void window.open('mailto:" . $user->getVar('email') . "','new');", |
||
59 | 'name' => _MD_EMAIL |
||
60 | ); |
||
61 | } |
||
62 | if ($user->getVar('url')) { |
||
63 | $userbar[] = array( |
||
64 | 'link' => "javascript:void window.open('" . $user->getVar('url') . "','new');", |
||
65 | 'name' => _MD_WWW |
||
66 | ); |
||
67 | } |
||
68 | if ($user->getVar('user_icq')) { |
||
69 | $userbar[] = array( |
||
70 | 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $user->getVar('user_icq') . "','new');", |
||
71 | 'name' => _MD_ICQ |
||
72 | ); |
||
73 | } |
||
74 | if ($user->getVar('user_aim')) { |
||
75 | $userbar[] = array( |
||
76 | 'link' => "javascript:void window.open('aim:goim?screenname=" . $user->getVar('user_aim') . '&message=Hi+' . $user->getVar('user_aim') . '+Are+you+there?' . "','new');", |
||
77 | 'name' => _MD_AIM |
||
78 | ); |
||
79 | } |
||
80 | if ($user->getVar('user_yim')) { |
||
81 | $userbar[] = array( |
||
82 | 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $user->getVar('user_yim') . '&.src=pg' . "','new');", |
||
83 | 'name' => _MD_YIM |
||
84 | ); |
||
85 | } |
||
86 | if ($user->getVar('user_msnm')) { |
||
87 | $userbar[] = array( |
||
88 | 'link' => "javascript:void window.open('http://members.msn.com?mem=" . $user->getVar('user_msnm') . "','new');", |
||
89 | 'name' => _MD_MSNM |
||
90 | ); |
||
91 | } |
||
92 | |||
93 | return $userbar; |
||
94 | } |
||
96 |