Conditions | 2 |
Paths | 2 |
Total Lines | 64 |
Code Lines | 39 |
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 |
||
60 | protected function getHtmlStructure(string $indent, string $partName, string $id, string $backgroundColor) |
||
61 | { |
||
62 | // html result. start with an empty string or a html comment |
||
63 | $html = $this->getBuilder()->getHtmlComment($partName . ' //', $indent); |
||
64 | |||
65 | // create a table container |
||
66 | $html .= $indent . '<table bgcolor="'. $backgroundColor . '"' |
||
67 | . ' width="'. $this->getBuilder()->emailBodyWidth() . '"' |
||
68 | . ' border="0" cellpadding="0" cellspacing="0" id="'. $id .'">' .PHP_EOL; |
||
69 | |||
70 | $html .= $indent . ' <tr>'.PHP_EOL; |
||
71 | $html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
||
72 | |||
73 | $html .= $this->getBuilder()->getHtmlComment('CENTERING TABLE //', $indent . ' '); |
||
74 | |||
75 | $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'.PHP_EOL; |
||
76 | $html .= $indent . ' <tr>'.PHP_EOL; |
||
77 | $html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
||
78 | |||
79 | $html .= $this->getBuilder()->getHtmlComment('FLEXIBLE CONTAINER //', $indent . ' '); |
||
80 | |||
81 | $html .= $indent . ' <table border="0" cellpadding="' . $this->cellPadding . '" cellspacing="0" width="'. $this->getBuilder()->emailBodyWidth() . '" class="flexibleContainer">'.PHP_EOL; |
||
82 | $html .= $indent . ' <tr>'.PHP_EOL; |
||
83 | $html .= $indent . ' <td align="center" valign="top" width="'. $this->getBuilder()->emailBodyWidth() . '" class="flexibleContainerCell">'.PHP_EOL; |
||
84 | |||
85 | $html .= $this->getBuilder()->getHtmlComment('CONTENT TABLE //', $indent . ' '); |
||
86 | |||
87 | $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'.PHP_EOL; |
||
88 | $html .= $indent . ' <tr>'.PHP_EOL; |
||
89 | $html .= $indent . ' <td valign="'. $this->verticalAlign .'" align="'. $this->horizontalAlign .'" bgcolor="'. $backgroundColor . '">'.PHP_EOL; |
||
90 | |||
91 | // render child elements collection |
||
92 | foreach ($this->childElements as $element){ |
||
93 | $html .= $element->getHtml($indent . ' '); |
||
94 | $html .= PHP_EOL ; |
||
95 | } |
||
96 | |||
97 | $html .= $indent . ' </td>'.PHP_EOL; |
||
98 | $html .= $indent . ' </tr>'.PHP_EOL; |
||
99 | $html .= $indent . ' </table>'.PHP_EOL; |
||
100 | |||
101 | $html .= $this->getBuilder()->getHtmlComment('// CONTENT TABLE', $indent . ' '); |
||
102 | |||
103 | $html .= $indent . ' </td>'.PHP_EOL; |
||
104 | $html .= $indent . ' </tr>'.PHP_EOL; |
||
105 | $html .= $indent . ' </table>'.PHP_EOL; |
||
106 | |||
107 | $html .= $this->getBuilder()->getHtmlComment('// FLEXIBLE CONTAINER', $indent . ' '); |
||
108 | |||
109 | $html .= $indent . ' </td>'.PHP_EOL; |
||
110 | $html .= $indent . ' </tr>'.PHP_EOL; |
||
111 | $html .= $indent . ' </table>'.PHP_EOL; |
||
112 | |||
113 | $html .= $this->getBuilder()->getHtmlComment('// CENTERING TABLE', $indent . ' '); |
||
114 | |||
115 | $html .= $indent . ' </td>'.PHP_EOL; |
||
116 | $html .= $indent . ' </tr>'.PHP_EOL; |
||
117 | $html .= $indent . '</table>'.PHP_EOL; |
||
118 | |||
119 | $html .= $this->getBuilder()->getHtmlComment('// ' . $partName, $indent); |
||
120 | $html .= PHP_EOL; |
||
121 | |||
122 | // done |
||
123 | return $html; |
||
124 | } |
||
125 | } |