Conditions | 7 |
Paths | 40 |
Total Lines | 53 |
Code Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
70 | public function render() |
||
71 | { |
||
72 | |||
73 | $ret = "<div id='wrapper_fee'"; |
||
74 | if (!$this->getVisible()) { |
||
75 | $ret .= " style='display:none'"; |
||
76 | } |
||
77 | $ret .= '>'; |
||
78 | |||
79 | foreach($this->getElements() as $key => $ele) { |
||
80 | $ret .= "<span><input class='form-control " . $this->getClass() . "' type='text' name='" |
||
|
|||
81 | . $this->getName() . "[]' title='" . $this->getTitle() . "' style='width:15%' maxlength='20' |
||
82 | value='" . $ele[0] . "'" . $this->getExtra(); |
||
83 | $ret .= ' />'; |
||
84 | $ret .= " <input class='form-control " . $this->getClass() . "' type='text' name='" |
||
85 | . $this->getName() . "desc[]' title='" . $this->getTitle() . "' style='width:70%' maxlength='255' |
||
86 | value='" . $ele[1] . "'" . $this->getExtra(); |
||
87 | if ($ele['placeholder']) { |
||
88 | $ret .= ' placeholder="' . $ele['placeholder'] . '"'; |
||
89 | } |
||
90 | $ret .= ' />'; |
||
91 | |||
92 | if (0 === (int)$key) { |
||
93 | // button to add new group |
||
94 | $ret .= '<a class="btn_fee_add btn btn-xs" href="javascript:void(0);" ><img src="' . \WGEVENTS_ICONS_URL_32 . '/add.png"/></a>'; |
||
95 | } else { |
||
96 | $ret .= '<a class="btn_fee_remove btn btn-xs" href="javascript:void(0);"><img src="' . \WGEVENTS_ICONS_URL_32 . '/remove.png"/></a>'; |
||
97 | } |
||
98 | |||
99 | $ret .= '</span>'; |
||
100 | } |
||
101 | $ret .= '</div>'; |
||
102 | |||
103 | // add one hidden group as template for new lines |
||
104 | $ret .= "<div id='hidden_group' class='hidden'><span><input class='form-control " . $this->getClass() . "' type='text' name='" |
||
105 | . $this->getName() . "[]' title='" . $this->getTitle() . "' style='width:15%' maxlength='20' |
||
106 | value=''" . $this->getExtra(); |
||
107 | if ($this->placeholder1) { |
||
108 | $ret .= ' placeholder="' . $this->getPlaceholder1() . '"'; |
||
109 | } |
||
110 | $ret .= ' />'; |
||
111 | $ret .= " <input class='form-control " . $this->getClass() . "' type='text' name='" |
||
112 | . $this->getName() . "desc[]' title='" . $this->getTitle() . "' style='width:70%' maxlength='255' |
||
113 | value=''" . $this->getExtra(); |
||
114 | if ($this->placeholder2) { |
||
115 | $ret .= ' placeholder="' . $this->getPlaceholder2() . '"'; |
||
116 | } |
||
117 | $ret .= ' />'; |
||
118 | $ret .= '<a class="btn_fee_remove btn btn-xs" href="javascript:void(0);"><img src="' . \WGEVENTS_ICONS_URL_32 . '/remove.png"/></a>'; |
||
119 | $ret .= '</span></div>'; |
||
120 | // end hidden group |
||
121 | |||
122 | return $ret; |
||
123 | |||
214 |