| Conditions | 11 |
| Paths | 324 |
| Total Lines | 64 |
| Code Lines | 39 |
| 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 |
||
| 71 | public function montaGaleria($altura, $section = 0, $setas = 1, $barra = 1, $delay = 6, $transp = 50, $largura = '100%') |
||
| 72 | { |
||
| 73 | if (0 == $section) { |
||
| 74 | $criterio = new \CriteriaCompo(new \Criteria('go2_12_ativo', 1)); |
||
| 75 | } else { |
||
| 76 | $criterio = new \CriteriaCompo(new \Criteria('sec_10_id', $section)); |
||
| 77 | $criterio->add(new \Criteria('go2_12_ativo', 1)); |
||
| 78 | } |
||
| 79 | // $go2_classe = mgo_getClass(MGO_MOD_TABELA1); |
||
| 80 | $go2_classe = new \XoopsModules\Mastopgo2\Go2(); |
||
| 81 | $dstacs = $go2_classe->pegaTudo($criterio); |
||
| 82 | if (is_int($largura)) { |
||
| 83 | $largura .= 'px'; |
||
| 84 | } |
||
| 85 | if ($dstacs) { |
||
| 86 | $ret = ' |
||
| 87 | <script src="' . XOOPS_URL . '/modules/' . MGO_MOD_DIR . '/assets/js/galeria/scripts/mootools.js" type="text/javascript"></script> |
||
| 88 | <script src="' . XOOPS_URL . '/modules/' . MGO_MOD_DIR . '/assets/js/galeria/scripts/jd.js" type="text/javascript"></script> |
||
| 89 | <link rel="stylesheet" href="' . XOOPS_URL . '/modules/' . MGO_MOD_DIR . '/assets/js/galeria/css/jd.css" type="text/css" media="screen"> |
||
| 90 | <style type="text/css"> |
||
| 91 | #dstacs_' . $section . ' |
||
| 92 | { |
||
| 93 | width: ' . $largura . ' !important; |
||
| 94 | height: ' . $altura . 'px !important; |
||
| 95 | z-index:5; |
||
| 96 | display: none; |
||
| 97 | border: 0; |
||
| 98 | } |
||
| 99 | </style> |
||
| 100 | <script type="text/javascript"> |
||
| 101 | function start_dstacs_' . $section . '() { |
||
| 102 | var dstacs_' . $section . ' = new gallery($("dstacs_' . $section . '"), { |
||
| 103 | timed: ' . ((count($dstacs) > 1) ? 'true' : 'false') . ', |
||
| 104 | showArrows: ' . ((1 == $setas) ? 'true' : 'false') . ', |
||
| 105 | showInfopane: ' . ((1 == $barra) ? 'true' : 'false') . ', |
||
| 106 | delay: ' . ($delay * 1000) . ', |
||
| 107 | slideInfoZoneOpacity: ' . (($transp > 0) ? '0.' . (int)((100 - $transp) / 10) : '1') . ', |
||
| 108 | embedLinks: true, |
||
| 109 | randomize: true |
||
| 110 | }); |
||
| 111 | } |
||
| 112 | window.onDomReady(start_dstacs_' . $section . '); |
||
| 113 | </script> |
||
| 114 | <!-- Mastop Go2 - http://www.mastop.com.br/produtos/go2/ --> |
||
| 115 | '; |
||
| 116 | $ret .= '<div align="center"><div id="dstacs_' . $section . '">'; |
||
| 117 | foreach ($dstacs as $v) { |
||
| 118 | if (0 == $v->getVar('go2_11_target')) { |
||
| 119 | $target = ''; |
||
| 120 | } else { |
||
| 121 | $target = "target='_blank'"; |
||
| 122 | } |
||
| 123 | $ret .= '<div class="imageElement">'; |
||
| 124 | $ret .= ('' != $v->getVar('go2_30_nome')) ? '<h3><a href="' . $v->pegaLink(false, false) . '" title="' . $v->getVar('go2_30_nome') . '" ' . $target . ' class="open">' . $v->getVar('go2_30_nome') . '</a></h3>' : '<h3> </h3>'; |
||
| 125 | $ret .= '<p></p>'; |
||
| 126 | $ret .= $v->pegaLink(true); |
||
| 127 | $ret .= '</div>'; |
||
| 128 | } |
||
| 129 | $ret .= '</div></div>'; |
||
| 130 | |||
| 131 | return $ret; |
||
| 132 | } |
||
| 133 | |||
| 134 | return false; |
||
| 135 | } |
||
| 137 |