| Conditions | 1 |
| Paths | 1 |
| Total Lines | 65 |
| Code Lines | 62 |
| 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 |
||
| 51 | public function pegar_venda_como_html() |
||
| 52 | { |
||
| 53 | $html = ''; |
||
| 54 | $html .= '<html>'; |
||
| 55 | $html .= '<head>'; |
||
| 56 | $html .= ' <title></title>'; |
||
| 57 | $html .= '</head>'; |
||
| 58 | $html .= '<body>'; |
||
| 59 | $html .= ''; |
||
| 60 | $html .= ' <table style="background-color: #cacaca;" width="100%" valign="center" align="center">'; |
||
| 61 | $html .= ' <tr align="center">'; |
||
| 62 | $html .= ' <td>'; |
||
| 63 | $html .= ' <h2>Orçamento Pedido #1</h2>'; |
||
| 64 | $html .= ' </td>'; |
||
| 65 | $html .= ' </tr> '; |
||
| 66 | $html .= ' </table>'; |
||
| 67 | $html .= ' <br>'; |
||
| 68 | $html .= ' <table width="100%" valign="center" align="center">'; |
||
| 69 | $html .= ' <tr style="background-color: #ccc;">'; |
||
| 70 | $html .= ' <td>Total: </td>'; |
||
| 71 | $html .= ' <td>R$ 24,55</td>'; |
||
| 72 | $html .= ' </tr>'; |
||
| 73 | $html .= ' <tr style="background-color: #fff;">'; |
||
| 74 | $html .= ' <td>Desconto: </td>'; |
||
| 75 | $html .= ' <td>R$ 4,55</td>'; |
||
| 76 | $html .= ' </tr>'; |
||
| 77 | $html .= ' <tr style="background-color: #ccc;">'; |
||
| 78 | $html .= ' <td>Valor a Pagar: </td>'; |
||
| 79 | $html .= ' <td>R$ 4,55</td>'; |
||
| 80 | $html .= ' </tr>'; |
||
| 81 | $html .= ' </table>'; |
||
| 82 | $html .= ' <br>'; |
||
| 83 | $html .= ' <table width="100%" valign="center" align="center">'; |
||
| 84 | $html .= ' <tr style="background-color: #cacaca;" align="center">'; |
||
| 85 | $html .= ' <td>'; |
||
| 86 | $html .= ' <h2>Produtos</h2>'; |
||
| 87 | $html .= ' </td>'; |
||
| 88 | $html .= ' </tr> '; |
||
| 89 | $html .= ' </table>'; |
||
| 90 | $html .= ' <br>'; |
||
| 91 | $html .= ' <table width="100%" valign="center" align="center">'; |
||
| 92 | $html .= ' <tr>'; |
||
| 93 | $html .= ' <td>'; |
||
| 94 | $html .= ' <table width="100%" valign="center" align="center">'; |
||
| 95 | $html .= ' <tr style="background-color: #cacaca;">'; |
||
| 96 | $html .= ' <td>Nome Produto</td>'; |
||
| 97 | $html .= ' <td>Quantidade</td>'; |
||
| 98 | $html .= ' <td>Valor</td>'; |
||
| 99 | $html .= ' </tr>'; |
||
| 100 | $html .= ''; |
||
| 101 | $html .= ' <tr>'; |
||
| 102 | $html .= ' <td>Alicate 14"</td>'; |
||
| 103 | $html .= ' <td>1</td>'; |
||
| 104 | $html .= ' <td>R$ 23,00</td>'; |
||
| 105 | $html .= ' </tr>'; |
||
| 106 | $html .= ' </table>'; |
||
| 107 | $html .= ' </td>'; |
||
| 108 | $html .= ' </tr>'; |
||
| 109 | $html .= ' </table>'; |
||
| 110 | $html .= ''; |
||
| 111 | $html .= '</body>'; |
||
| 112 | $html .= '</html>'; |
||
| 113 | |||
| 114 | return $html; |
||
| 115 | } |
||
| 116 | |||
| 117 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.